:: krowemoh

Friday | 27 JUN 2025
Posts Links Other About Now

previous
next

TPC-H dbgen

2025-06-18
tpch

Getting the dbgen tool to compile was a bit of a project. It looks like things have changed since it was created and so I needed to fudge a few things.The actual errors I ran into are further down.

The first change is to the makefile.suite:

  CC      = gcc
  DATABASE=DB2
  MACHINE =LINUX
  WORKLOAD =TPCH

This will set up the makefile.

Next is to turn off warnings that stopped compilation, to do that we need to add a flag to CFLAGS:

   -Wno-incompatible-pointer-types

The CFLAGS will then look like:

CFLAGS  = -g -DDBNAME=\"dss\" -D$(MACHINE) -D$(DATABASE) -D$(WORKLOAD) -DRNG_TEST -D_FILE_OFFSET_BITS=64 -Wno-incompatible-pointer-types

With the makefile.suite done, now to update dss.h:

  typedef struct
  {
     char     *name;
     char     *comment;
     DSS_HUGE      base;
     int       (*loader)(void *x, int y);
     long      (*gen_seed)(int x, int y);
     int       child;
     DSS_HUGE vtotal;
  }         tdef;

Specifically the loader and gen_seed need to be updated to specify the parameters.

Now we can run make:

make -f makefile.suite

This should hopefully compile and create an executable called dbgen.

We can then use this to create the smallest dataset:

./dbgen

This will create 8 table files that we can move to a tables directory:

mkdir tables
mv *.tbl tables/

Now let's make sure the files are correct:

ls -lt tables/ 

total 1074924
-rw-r--r-- 1 username username  24346144 Jun 18 10:30 customer.tbl
-rw-r--r-- 1 username username 759863287 Jun 18 10:30 lineitem.tbl
-rw-r--r-- 1 username username      2224 Jun 18 10:30 nation.tbl
-rw-r--r-- 1 username username 171952161 Jun 18 10:30 orders.tbl
-rw-r--r-- 1 username username  24135125 Jun 18 10:30 part.tbl
-rw-r--r-- 1 username username 118984616 Jun 18 10:30 partsupp.tbl
-rw-r--r-- 1 username username       389 Jun 18 10:30 region.tbl
-rw-r--r-- 1 username username   1409184 Jun 18 10:30 supplier.tbl

Errors

This was the error that was resolved by updating CFLAGS:

driver.c:182:17: error: initialization of ‘int (*)(void)’ from incompatible pointer type ‘int (*)(part_t *, int)’ [-Wincompatible-pointer-types]
  182 |                 pr_part, sd_part, PSUPP, 0},
      |                 ^~~~~~~

This error was resolved by updating dss.h:

In file included from driver.c:103:
dss.h:180:16: note: declared here
  180 |    int       (*loader) ();
      |                ^~~~~~
driver.c:340:33: error: too many arguments to function ‘tdefs[tnum].loader’; expected 0, have 2
  340 |                                 tdefs[tnum].loader(&supp, upd_num);
      |