Created
April 16, 2019 15:18
-
-
Save mrzzzrm/82ac2721e87eb5a6645a5482c0ab7f7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Only in ../tpch-dbgen/: answers | |
Only in ../tpch-dbgen/: bcd2.c | |
Only in ../tpch-dbgen/: bcd2.h | |
Only in ../tpch-dbgen/: bcd2.o | |
diff -p third_party/tpch-dbgen/bm_utils.c ../tpch-dbgen/bm_utils.c | |
*** third_party/tpch-dbgen/bm_utils.c 2019-04-16 17:06:53.528759641 +0200 | |
--- ../tpch-dbgen/bm_utils.c 2019-04-16 11:39:42.886691071 +0200 | |
*************** | |
*** 67,73 **** | |
#endif /* HP */ | |
#include <ctype.h> | |
#include <math.h> | |
! #if !defined(_POSIX_SOURCE) && !defined(__APPLE__) | |
#include <malloc.h> | |
#endif /* POSIX_SOURCE */ | |
#include <fcntl.h> | |
--- 67,73 ---- | |
#endif /* HP */ | |
#include <ctype.h> | |
#include <math.h> | |
! #ifndef _POSIX_SOURCE | |
#include <malloc.h> | |
#endif /* POSIX_SOURCE */ | |
#include <fcntl.h> | |
*************** pick_str(distribution *s, int c, char *t | |
*** 230,238 **** | |
RANDOM(j, 1, s->list[s->count - 1].weight, c); | |
while (s->list[i].weight < j) | |
i++; | |
! // HYRISE: Avoid redundantly obtaining the length of a string | |
! if (!s->list[i].len) s->list[i].len = strlen(s->list[i].text); | |
! memcpy(target, s->list[i].text, s->list[i].len + 1); | |
return(i); | |
} | |
--- 230,236 ---- | |
RANDOM(j, 1, s->list[s->count - 1].weight, c); | |
while (s->list[i].weight < j) | |
i++; | |
! strcpy(target, s->list[i].text); | |
return(i); | |
} | |
*************** long weight, | |
*** 372,378 **** | |
} | |
target->permute = (long *)NULL; | |
fclose(fp); | |
- | |
return; | |
} | |
--- 370,375 ---- | |
Only in ../tpch-dbgen/: bm_utils.o | |
Only in ../tpch-dbgen/: BUGS | |
diff -p third_party/tpch-dbgen/build.c ../tpch-dbgen/build.c | |
*** third_party/tpch-dbgen/build.c 2019-04-16 17:08:35.315673948 +0200 | |
--- ../tpch-dbgen/build.c 2019-04-16 11:39:42.886691071 +0200 | |
*************** extern adhoc_t adhocs[]; | |
*** 65,73 **** | |
#define TEXT(avg, sd, tgt) dbg_text(tgt, (int)(avg * V_STR_LOW),(int)(avg * V_STR_HGH), sd) | |
static void gen_phone PROTO((DSS_HUGE ind, char *target, long seed)); | |
- // HYRISE: Made public so we can free the allocated memory later | |
- char **asc_date = NULL; | |
- | |
DSS_HUGE | |
rpb_routine(DSS_HUGE p) | |
{ | |
--- 65,70 ---- | |
*************** mk_order(DSS_HUGE index, order_t * o, lo | |
*** 160,165 **** | |
--- 157,163 ---- | |
DSS_HUGE c_date; | |
DSS_HUGE clk_num; | |
DSS_HUGE supp_num; | |
+ static char **asc_date = NULL; | |
char tmp_str[2]; | |
char **mk_ascdate PROTO((void)); | |
int delta = 1; | |
*************** mk_order(DSS_HUGE index, order_t * o, lo | |
*** 188,195 **** | |
RANDOM(tmp_date, O_ODATE_MIN, O_ODATE_MAX, O_ODATE_SD); | |
! // HYRISE: We know that dates are always yyyy-mm-dd + \0. | |
! memcpy(o->odate, asc_date[tmp_date - STARTDATE], 11); | |
pick_str(&o_priority_set, O_PRIO_SD, o->opriority); | |
RANDOM(clk_num, 1, MAX((scale * O_CLRK_SCL), O_CLRK_SCL), O_CLRK_SD); | |
--- 186,192 ---- | |
RANDOM(tmp_date, O_ODATE_MIN, O_ODATE_MAX, O_ODATE_SD); | |
! strcpy(o->odate, asc_date[tmp_date - STARTDATE]); | |
pick_str(&o_priority_set, O_PRIO_SD, o->opriority); | |
RANDOM(clk_num, 1, MAX((scale * O_CLRK_SCL), O_CLRK_SCL), O_CLRK_SD); | |
*************** mk_order(DSS_HUGE index, order_t * o, lo | |
*** 240,249 **** | |
RANDOM(r_date, L_RDTE_MIN, L_RDTE_MAX, L_RDTE_SD); | |
r_date += s_date; | |
! // HYRISE: We know that dates are always yyyy-mm-dd + \0. | |
! memcpy(o->l[lcnt].sdate, asc_date[s_date - STARTDATE], 11); | |
! memcpy(o->l[lcnt].cdate, asc_date[c_date - STARTDATE], 11); | |
! memcpy(o->l[lcnt].rdate, asc_date[r_date - STARTDATE], 11); | |
if (julian(r_date) <= CURRENTDATE) | |
--- 237,246 ---- | |
RANDOM(r_date, L_RDTE_MIN, L_RDTE_MAX, L_RDTE_SD); | |
r_date += s_date; | |
! | |
! strcpy(o->l[lcnt].sdate, asc_date[s_date - STARTDATE]); | |
! strcpy(o->l[lcnt].cdate, asc_date[c_date - STARTDATE]); | |
! strcpy(o->l[lcnt].rdate, asc_date[r_date - STARTDATE]); | |
if (julian(r_date) <= CURRENTDATE) | |
Only in ../tpch-dbgen/: build.o | |
Only in ../tpch-dbgen/: check_answers | |
Only in third_party/tpch-dbgen: CMakeLists.txt | |
Only in ../tpch-dbgen/: column_split.sh | |
Only in ../tpch-dbgen/: customer.tbl | |
Only in ../tpch-dbgen/: dbgen | |
Only in ../tpch-dbgen/: dbgen.dsp | |
Only in ../tpch-dbgen/: dists.dss | |
diff -p third_party/tpch-dbgen/driver.c ../tpch-dbgen/driver.c | |
*** third_party/tpch-dbgen/driver.c 2019-04-16 17:15:09.968328697 +0200 | |
--- ../tpch-dbgen/driver.c 2019-04-16 11:53:30.786520451 +0200 | |
*************** | |
*** 102,108 **** | |
#include "dss.h" | |
#include "dsstypes.h" | |
! #include "tpch_dbgen.h" | |
extern int optind, opterr; | |
--- 102,118 ---- | |
#include "dss.h" | |
#include "dsstypes.h" | |
! | |
! /* | |
! * Function prototypes | |
! */ | |
! void usage (void); | |
! void kill_load (void); | |
! int pload (int tbl); | |
! void gen_tbl (int tnum, DSS_HUGE start, DSS_HUGE count, long upd_num); | |
! int pr_drange (int tbl, DSS_HUGE min, DSS_HUGE cnt, long num); | |
! int set_files (int t, int pload); | |
! int partial (int, int); | |
extern int optind, opterr; | |
*************** static int bTableSet = 0; | |
*** 141,146 **** | |
--- 151,170 ---- | |
*/ | |
/* | |
+ * flat file print functions; used with -F(lat) option | |
+ */ | |
+ int pr_cust (customer_t * c, int mode); | |
+ int pr_line (order_t * o, int mode); | |
+ int pr_order (order_t * o, int mode); | |
+ int pr_part (part_t * p, int mode); | |
+ int pr_psupp (part_t * p, int mode); | |
+ int pr_supp (supplier_t * s, int mode); | |
+ int pr_order_line (order_t * o, int mode); | |
+ int pr_part_psupp (part_t * p, int mode); | |
+ int pr_nation (code_t * c, int mode); | |
+ int pr_region (code_t * c, int mode); | |
+ | |
+ /* | |
* seed generation functions; used with '-O s' option | |
*/ | |
long sd_cust (int child, DSS_HUGE skip_count); | |
*************** long sd_supp (int child, DSS_HUGE skip_c | |
*** 152,180 **** | |
long sd_order_line (int child, DSS_HUGE skip_count); | |
long sd_part_psupp (int child, DSS_HUGE skip_count); | |
- // HYRISE: removed loader-functions (pr_part, ...) as we do not need them. We don't print | |
- // the tables to text. | |
tdef tdefs[] = | |
{ | |
{"part.tbl", "part table", 200000, | |
! NULL, sd_part, PSUPP, 0}, | |
{"partsupp.tbl", "partsupplier table", 200000, | |
! NULL, sd_psupp, NONE, 0}, | |
{"supplier.tbl", "suppliers table", 10000, | |
! NULL, sd_supp, NONE, 0}, | |
{"customer.tbl", "customers table", 150000, | |
! NULL, sd_cust, NONE, 0}, | |
{"orders.tbl", "order table", 150000, | |
! NULL, sd_order, LINE, 0}, | |
{"lineitem.tbl", "lineitem table", 150000, | |
! NULL, sd_line, NONE, 0}, | |
{"orders.tbl", "orders/lineitem tables", 150000, | |
! NULL, sd_order, LINE, 0}, | |
{"part.tbl", "part/partsupplier tables", 200000, | |
! NULL, sd_part, PSUPP, 0}, | |
! {"nation.tbl", "nation table", NATIONS_COUNT, | |
! NULL, NO_LFUNC, NONE, 0}, | |
! {"region.tbl", "region table", REGIONS_COUNT, | |
! NULL, NO_LFUNC, NONE, 0}, | |
}; | |
--- 176,800 ---- | |
long sd_order_line (int child, DSS_HUGE skip_count); | |
long sd_part_psupp (int child, DSS_HUGE skip_count); | |
tdef tdefs[] = | |
{ | |
{"part.tbl", "part table", 200000, | |
! pr_part, sd_part, PSUPP, 0}, | |
{"partsupp.tbl", "partsupplier table", 200000, | |
! pr_psupp, sd_psupp, NONE, 0}, | |
{"supplier.tbl", "suppliers table", 10000, | |
! pr_supp, sd_supp, NONE, 0}, | |
{"customer.tbl", "customers table", 150000, | |
! pr_cust, sd_cust, NONE, 0}, | |
{"orders.tbl", "order table", 150000, | |
! pr_order, sd_order, LINE, 0}, | |
{"lineitem.tbl", "lineitem table", 150000, | |
! pr_line, sd_line, NONE, 0}, | |
{"orders.tbl", "orders/lineitem tables", 150000, | |
! pr_order_line, sd_order, LINE, 0}, | |
{"part.tbl", "part/partsupplier tables", 200000, | |
! pr_part_psupp, sd_part, PSUPP, 0}, | |
! {"nation.tbl", "nation table", NATIONS_MAX, | |
! pr_nation, NO_LFUNC, NONE, 0}, | |
! {"region.tbl", "region table", NATIONS_MAX, | |
! pr_region, NO_LFUNC, NONE, 0}, | |
}; | |
+ /* | |
+ * re-set default output file names | |
+ */ | |
+ int | |
+ set_files (int i, int pload) | |
+ { | |
+ char line[80], *new_name; | |
+ | |
+ if (table & (1 << i)) | |
+ child_table: | |
+ { | |
+ if (pload != -1) | |
+ sprintf (line, "%s.%d", tdefs[i].name, pload); | |
+ else | |
+ { | |
+ printf ("Enter new destination for %s data: ", | |
+ tdefs[i].name); | |
+ if (fgets (line, sizeof (line), stdin) == NULL) | |
+ return (-1);; | |
+ if ((new_name = strchr (line, '\n')) != NULL) | |
+ *new_name = '\0'; | |
+ if ((int)strlen (line) == 0) | |
+ return (0); | |
+ } | |
+ new_name = (char *) malloc ((int)strlen (line) + 1); | |
+ MALLOC_CHECK (new_name); | |
+ strcpy (new_name, line); | |
+ tdefs[i].name = new_name; | |
+ if (tdefs[i].child != NONE) | |
+ { | |
+ i = tdefs[i].child; | |
+ tdefs[i].child = NONE; | |
+ goto child_table; | |
+ } | |
+ } | |
+ | |
+ return (0); | |
+ } | |
+ | |
+ | |
+ | |
+ /* | |
+ * read the distributions needed in the benchamrk | |
+ */ | |
+ void | |
+ load_dists (void) | |
+ { | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "p_cntr", &p_cntr_set); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "colors", &colors); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "p_types", &p_types_set); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "nations", &nations); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "regions", ®ions); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "o_oprio", | |
+ &o_priority_set); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "instruct", | |
+ &l_instruct_set); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "smode", &l_smode_set); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "category", | |
+ &l_category_set); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "rflag", &l_rflag_set); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "msegmnt", &c_mseg_set); | |
+ | |
+ /* load the distributions that contain text generation */ | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "nouns", &nouns); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "verbs", &verbs); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "adjectives", &adjectives); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "adverbs", &adverbs); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "auxillaries", &auxillaries); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "terminators", &terminators); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "articles", &articles); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "prepositions", &prepositions); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "grammar", &grammar); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "np", &np); | |
+ read_dist (env_config (DIST_TAG, DIST_DFLT), "vp", &vp); | |
+ | |
+ } | |
+ | |
+ /* | |
+ * generate a particular table | |
+ */ | |
+ void | |
+ gen_tbl (int tnum, DSS_HUGE start, DSS_HUGE count, long upd_num) | |
+ { | |
+ static order_t o; | |
+ supplier_t supp; | |
+ customer_t cust; | |
+ part_t part; | |
+ code_t code; | |
+ static int completed = 0; | |
+ DSS_HUGE i; | |
+ | |
+ DSS_HUGE rows_per_segment=0; | |
+ DSS_HUGE rows_this_segment=-1; | |
+ DSS_HUGE residual_rows=0; | |
+ | |
+ if (insert_segments) | |
+ { | |
+ rows_per_segment = count / insert_segments; | |
+ residual_rows = count - (rows_per_segment * insert_segments); | |
+ } | |
+ | |
+ for (i = start; count; count--, i++) | |
+ { | |
+ LIFENOISE (1000, i); | |
+ row_start(tnum); | |
+ | |
+ switch (tnum) | |
+ { | |
+ case LINE: | |
+ case ORDER: | |
+ case ORDER_LINE: | |
+ mk_order (i, &o, upd_num % 10000); | |
+ | |
+ if (insert_segments && (upd_num > 0)) | |
+ if((upd_num / 10000) < residual_rows) | |
+ { | |
+ if((++rows_this_segment) > rows_per_segment) | |
+ { | |
+ rows_this_segment=0; | |
+ upd_num += 10000; | |
+ } | |
+ } | |
+ else | |
+ { | |
+ if((++rows_this_segment) >= rows_per_segment) | |
+ { | |
+ rows_this_segment=0; | |
+ upd_num += 10000; | |
+ } | |
+ } | |
+ | |
+ if (set_seeds == 0) | |
+ tdefs[tnum].loader(&o, upd_num); | |
+ break; | |
+ case SUPP: | |
+ mk_supp (i, &supp); | |
+ if (set_seeds == 0) | |
+ tdefs[tnum].loader(&supp, upd_num); | |
+ break; | |
+ case CUST: | |
+ mk_cust (i, &cust); | |
+ if (set_seeds == 0) | |
+ tdefs[tnum].loader(&cust, upd_num); | |
+ break; | |
+ case PSUPP: | |
+ case PART: | |
+ case PART_PSUPP: | |
+ mk_part (i, &part); | |
+ if (set_seeds == 0) | |
+ tdefs[tnum].loader(&part, upd_num); | |
+ break; | |
+ case NATION: | |
+ mk_nation (i, &code); | |
+ if (set_seeds == 0) | |
+ tdefs[tnum].loader(&code, 0); | |
+ break; | |
+ case REGION: | |
+ mk_region (i, &code); | |
+ if (set_seeds == 0) | |
+ tdefs[tnum].loader(&code, 0); | |
+ break; | |
+ } | |
+ row_stop(tnum); | |
+ if (set_seeds && (i % tdefs[tnum].base) < 2) | |
+ { | |
+ printf("\nSeeds for %s at rowcount %ld\n", tdefs[tnum].comment, i); | |
+ dump_seeds(tnum); | |
+ } | |
+ } | |
+ completed |= 1 << tnum; | |
+ } | |
+ | |
+ | |
+ | |
+ void | |
+ usage (void) | |
+ { | |
+ fprintf (stderr, "%s\n%s\n\t%s\n%s %s\n\n", | |
+ "USAGE:", | |
+ "dbgen [-{vf}][-T {pcsoPSOL}]", | |
+ "[-s <scale>][-C <procs>][-S <step>]", | |
+ "dbgen [-v] [-O m] [-s <scale>]", | |
+ "[-U <updates>]"); | |
+ fprintf (stderr, "Basic Options\n===========================\n"); | |
+ fprintf (stderr, "-C <n> -- separate data set into <n> chunks (requires -S, default: 1)\n"); | |
+ fprintf (stderr, "-f -- force. Overwrite existing files\n"); | |
+ fprintf (stderr, "-h -- display this message\n"); | |
+ fprintf (stderr, "-q -- enable QUIET mode\n"); | |
+ fprintf (stderr, "-s <n> -- set Scale Factor (SF) to <n> (default: 1) \n"); | |
+ fprintf (stderr, "-S <n> -- build the <n>th step of the data/update set (used with -C or -U)\n"); | |
+ fprintf (stderr, "-U <n> -- generate <n> update sets\n"); | |
+ fprintf (stderr, "-v -- enable VERBOSE mode\n"); | |
+ fprintf (stderr, "\nAdvanced Options\n===========================\n"); | |
+ fprintf (stderr, "-b <s> -- load distributions for <s> (default: dists.dss)\n"); | |
+ fprintf (stderr, "-d <n> -- split deletes between <n> files (requires -U)\n"); | |
+ fprintf (stderr, "-i <n> -- split inserts between <n> files (requires -U)\n"); | |
+ fprintf (stderr, "-T c -- generate cutomers ONLY\n"); | |
+ fprintf (stderr, "-T l -- generate nation/region ONLY\n"); | |
+ fprintf (stderr, "-T L -- generate lineitem ONLY\n"); | |
+ fprintf (stderr, "-T n -- generate nation ONLY\n"); | |
+ fprintf (stderr, "-T o -- generate orders/lineitem ONLY\n"); | |
+ fprintf (stderr, "-T O -- generate orders ONLY\n"); | |
+ fprintf (stderr, "-T p -- generate parts/partsupp ONLY\n"); | |
+ fprintf (stderr, "-T P -- generate parts ONLY\n"); | |
+ fprintf (stderr, "-T r -- generate region ONLY\n"); | |
+ fprintf (stderr, "-T s -- generate suppliers ONLY\n"); | |
+ fprintf (stderr, "-T S -- generate partsupp ONLY\n"); | |
+ fprintf (stderr, | |
+ "\nTo generate the SF=1 (1GB), validation database population, use:\n"); | |
+ fprintf (stderr, "\tdbgen -vf -s 1\n"); | |
+ fprintf (stderr, "\nTo generate updates for a SF=1 (1GB), use:\n"); | |
+ fprintf (stderr, "\tdbgen -v -U 1 -s 1\n"); | |
+ } | |
+ | |
+ /* | |
+ * int partial(int tbl, int s) -- generate the s-th part of the named tables data | |
+ */ | |
+ int | |
+ partial (int tbl, int s) | |
+ { | |
+ DSS_HUGE rowcnt; | |
+ DSS_HUGE extra; | |
+ | |
+ if (verbose > 0) | |
+ { | |
+ fprintf (stderr, "\tStarting to load stage %d of %ld for %s...", | |
+ s, children, tdefs[tbl].comment); | |
+ } | |
+ | |
+ set_files (tbl, s); | |
+ | |
+ rowcnt = set_state(tbl, scale, children, s, &extra); | |
+ | |
+ if (s == children) | |
+ gen_tbl (tbl, rowcnt * (s - 1) + 1, rowcnt + extra, upd_num); | |
+ else | |
+ gen_tbl (tbl, rowcnt * (s - 1) + 1, rowcnt, upd_num); | |
+ | |
+ if (verbose > 0) | |
+ fprintf (stderr, "done.\n"); | |
+ | |
+ return (0); | |
+ } | |
+ | |
+ void | |
+ process_options (int count, char **vector) | |
+ { | |
+ int option; | |
+ FILE *pF; | |
+ | |
+ while ((option = getopt (count, vector, | |
+ "b:C:d:fi:hO:P:qs:S:T:U:v")) != -1) | |
+ switch (option) | |
+ { | |
+ case 'b': /* load distributions from named file */ | |
+ d_path = (char *)malloc((int)strlen(optarg) + 1); | |
+ MALLOC_CHECK(d_path); | |
+ strcpy(d_path, optarg); | |
+ if ((pF = fopen(d_path, "r")) == NULL) | |
+ { | |
+ fprintf(stderr, "ERROR: Invalid argument to -b"); | |
+ exit(-1); | |
+ } | |
+ else | |
+ fclose(pF); | |
+ | |
+ break; | |
+ case 'C': | |
+ children = atoi (optarg); | |
+ break; | |
+ case 'd': | |
+ delete_segments = atoi (optarg); | |
+ break; | |
+ case 'f': /* blind overwrites; Force */ | |
+ force = 1; | |
+ break; | |
+ case 'i': | |
+ insert_segments = atoi (optarg); | |
+ break; | |
+ case 'q': /* all prompts disabled */ | |
+ verbose = -1; | |
+ break; | |
+ case 's': /* scale by Percentage of base rowcount */ | |
+ case 'P': /* for backward compatibility */ | |
+ flt_scale = atof (optarg); | |
+ if (flt_scale < MIN_SCALE) | |
+ { | |
+ int i; | |
+ int int_scale; | |
+ | |
+ scale = 1; | |
+ int_scale = (int)(1000 * flt_scale); | |
+ for (i = PART; i < REGION; i++) | |
+ { | |
+ tdefs[i].base = (DSS_HUGE)(int_scale * tdefs[i].base)/1000; | |
+ if (tdefs[i].base < 1) | |
+ tdefs[i].base = 1; | |
+ } | |
+ } | |
+ else | |
+ scale = (long) flt_scale; | |
+ if (scale > MAX_SCALE) | |
+ { | |
+ fprintf (stderr, "%s %5.0f %s\n\t%s\n\n", | |
+ "NOTE: Data generation for scale factors >", | |
+ MAX_SCALE, | |
+ "GB is still in development,", | |
+ "and is not yet supported.\n"); | |
+ fprintf (stderr, | |
+ "Your resulting data set MAY NOT BE COMPLIANT!\n"); | |
+ } | |
+ break; | |
+ case 'S': /* generate a particular STEP */ | |
+ step = atoi (optarg); | |
+ break; | |
+ case 'U': /* generate flat files for update stream */ | |
+ updates = atoi (optarg); | |
+ break; | |
+ case 'v': /* life noises enabled */ | |
+ verbose = 1; | |
+ break; | |
+ case 'T': /* generate a specifc table */ | |
+ switch (*optarg) | |
+ { | |
+ case 'c': /* generate customer ONLY */ | |
+ table = 1 << CUST; | |
+ bTableSet = 1; | |
+ break; | |
+ case 'L': /* generate lineitems ONLY */ | |
+ table = 1 << LINE; | |
+ bTableSet = 1; | |
+ break; | |
+ case 'l': /* generate code table ONLY */ | |
+ table = 1 << NATION; | |
+ table |= 1 << REGION; | |
+ bTableSet = 1; | |
+ break; | |
+ case 'n': /* generate nation table ONLY */ | |
+ table = 1 << NATION; | |
+ bTableSet = 1; | |
+ break; | |
+ case 'O': /* generate orders ONLY */ | |
+ table = 1 << ORDER; | |
+ bTableSet = 1; | |
+ break; | |
+ case 'o': /* generate orders/lineitems ONLY */ | |
+ table = 1 << ORDER_LINE; | |
+ bTableSet = 1; | |
+ break; | |
+ case 'P': /* generate part ONLY */ | |
+ table = 1 << PART; | |
+ bTableSet = 1; | |
+ break; | |
+ case 'p': /* generate part/partsupp ONLY */ | |
+ table = 1 << PART_PSUPP; | |
+ bTableSet = 1; | |
+ break; | |
+ case 'r': /* generate region table ONLY */ | |
+ table = 1 << REGION; | |
+ bTableSet = 1; | |
+ break; | |
+ case 'S': /* generate partsupp ONLY */ | |
+ table = 1 << PSUPP; | |
+ bTableSet = 1; | |
+ break; | |
+ case 's': /* generate suppliers ONLY */ | |
+ table = 1 << SUPP; | |
+ bTableSet = 1; | |
+ break; | |
+ default: | |
+ fprintf (stderr, "Unknown table name %s\n", | |
+ optarg); | |
+ usage (); | |
+ exit (1); | |
+ } | |
+ break; | |
+ case 'O': /* optional actions */ | |
+ switch (tolower (*optarg)) | |
+ { | |
+ case 's': /* calibrate the RNG usage */ | |
+ set_seeds = 1; | |
+ break; | |
+ default: | |
+ fprintf (stderr, "Unknown option name %s\n", | |
+ optarg); | |
+ usage (); | |
+ exit (1); | |
+ } | |
+ break; | |
+ default: | |
+ printf ("ERROR: option '%c' unknown.\n", | |
+ *(vector[optind] + 1)); | |
+ case 'h': /* something unexpected */ | |
+ fprintf (stderr, | |
+ "%s Population Generator (Version %d.%d.%d build %d)\n", | |
+ NAME, VERSION, RELEASE, PATCH, BUILD); | |
+ fprintf (stderr, "Copyright %s %s\n", TPC, C_DATES); | |
+ usage (); | |
+ exit (1); | |
+ } | |
+ | |
+ return; | |
+ } | |
+ | |
+ void validate_options(void) | |
+ { | |
+ // DBGenOptions, 3.1 | |
+ if (children != 1) | |
+ { | |
+ if (updates != 0) | |
+ { | |
+ fprintf(stderr, "ERROR: -C is not valid when generating updates\n"); | |
+ exit(-1); | |
+ } | |
+ if (step == -1) | |
+ { | |
+ fprintf(stderr, "ERROR: -S must be specified when generating data in multiple chunks\n"); | |
+ exit(-1); | |
+ } | |
+ } | |
+ | |
+ // DBGenOptions, 3.3 | |
+ if (updates == 0) | |
+ { | |
+ if ((insert_segments != 0) || (delete_segments != 0)) | |
+ { | |
+ fprintf(stderr, "ERROR: -d/-i are only valid when generating updates\n"); | |
+ exit(-1); | |
+ } | |
+ } | |
+ | |
+ // DBGenOptions, 3.9 | |
+ if (step != -1) | |
+ { | |
+ if ((children == 1) && (updates == 0)) | |
+ { | |
+ fprintf(stderr, "ERROR: -S is only valid when generating data in multiple chunks or generating updates\n"); | |
+ exit(-1); | |
+ } | |
+ } | |
+ | |
+ // DBGenOptions, 3.10 | |
+ if (bTableSet && (updates != 0)) | |
+ { | |
+ fprintf(stderr, "ERROR: -T not valid when generating updates\n"); | |
+ exit(-1); | |
+ } | |
+ | |
+ return; | |
+ } | |
+ | |
+ | |
+ /* | |
+ * MAIN | |
+ * | |
+ * assumes the existance of getopt() to clean up the command | |
+ * line handling | |
+ */ | |
+ int | |
+ main (int ac, char **av) | |
+ { | |
+ DSS_HUGE i; | |
+ | |
+ table = (1 << CUST) | | |
+ (1 << SUPP) | | |
+ (1 << NATION) | | |
+ (1 << REGION) | | |
+ (1 << PART_PSUPP) | | |
+ (1 << ORDER_LINE); | |
+ force = 0; | |
+ insert_segments=0; | |
+ delete_segments=0; | |
+ insert_orders_segment=0; | |
+ insert_lineitem_segment=0; | |
+ delete_segment=0; | |
+ verbose = 0; | |
+ set_seeds = 0; | |
+ scale = 1; | |
+ flt_scale = 1.0; | |
+ updates = 0; | |
+ step = -1; | |
+ tdefs[ORDER].base *= | |
+ ORDERS_PER_CUST; /* have to do this after init */ | |
+ tdefs[LINE].base *= | |
+ ORDERS_PER_CUST; /* have to do this after init */ | |
+ tdefs[ORDER_LINE].base *= | |
+ ORDERS_PER_CUST; /* have to do this after init */ | |
+ children = 1; | |
+ d_path = NULL; | |
+ | |
+ #ifdef NO_SUPPORT | |
+ signal (SIGINT, exit); | |
+ #endif /* NO_SUPPORT */ | |
+ process_options (ac, av); | |
+ validate_options(); | |
+ #if (defined(WIN32)&&!defined(_POSIX_)) | |
+ for (i = 0; i < ac; i++) | |
+ { | |
+ spawn_args[i] = malloc (((int)strlen (av[i]) + 1) * sizeof (char)); | |
+ MALLOC_CHECK (spawn_args[i]); | |
+ strcpy (spawn_args[i], av[i]); | |
+ } | |
+ spawn_args[ac] = NULL; | |
+ #endif | |
+ | |
+ if (verbose >= 0) | |
+ { | |
+ fprintf (stderr, | |
+ "%s Population Generator (Version %d.%d.%d)\n", | |
+ NAME, VERSION, RELEASE, PATCH); | |
+ fprintf (stderr, "Copyright %s %s\n", TPC, C_DATES); | |
+ } | |
+ | |
+ load_dists (); | |
+ #ifdef RNG_TEST | |
+ for (i=0; i <= MAX_STREAM; i++) | |
+ Seed[i].nCalls = 0; | |
+ #endif | |
+ /* have to do this after init */ | |
+ tdefs[NATION].base = nations.count; | |
+ tdefs[REGION].base = regions.count; | |
+ | |
+ /* | |
+ * updates are never parallelized | |
+ */ | |
+ if (updates) | |
+ { | |
+ /* | |
+ * set RNG to start generating rows beyond SF=scale | |
+ */ | |
+ set_state (ORDER, scale, 100, 101, &i); | |
+ rowcnt = (int)(tdefs[ORDER_LINE].base / 10000 * scale * UPD_PCT); | |
+ if (step > 0) | |
+ { | |
+ /* | |
+ * adjust RNG for any prior update generation | |
+ */ | |
+ for (i=1; i < step; i++) | |
+ { | |
+ sd_order(0, rowcnt); | |
+ sd_line(0, rowcnt); | |
+ } | |
+ upd_num = step - 1; | |
+ } | |
+ else | |
+ upd_num = 0; | |
+ | |
+ while (upd_num < updates) | |
+ { | |
+ if (verbose > 0) | |
+ fprintf (stderr, | |
+ "Generating update pair #%ld for %s", | |
+ upd_num + 1, tdefs[ORDER_LINE].comment); | |
+ insert_orders_segment=0; | |
+ insert_lineitem_segment=0; | |
+ delete_segment=0; | |
+ minrow = upd_num * rowcnt + 1; | |
+ gen_tbl (ORDER_LINE, minrow, rowcnt, upd_num + 1); | |
+ if (verbose > 0) | |
+ fprintf (stderr, "done.\n"); | |
+ pr_drange (ORDER_LINE, minrow, rowcnt, upd_num + 1); | |
+ upd_num++; | |
+ } | |
+ | |
+ exit (0); | |
+ } | |
+ | |
+ /** | |
+ ** actual data generation section starts here | |
+ **/ | |
+ | |
+ /* | |
+ * traverse the tables, invoking the appropriate data generation routine for any to be built | |
+ */ | |
+ for (i = PART; i <= REGION; i++) | |
+ if (table & (1 << i)) | |
+ { | |
+ if (children > 1 && i < NATION) | |
+ { | |
+ partial ((int)i, step); | |
+ } | |
+ else | |
+ { | |
+ minrow = 1; | |
+ if (i < NATION) | |
+ rowcnt = tdefs[i].base * scale; | |
+ else | |
+ rowcnt = tdefs[i].base; | |
+ if (verbose > 0) | |
+ fprintf (stderr, "Generating data for %s %li", tdefs[i].comment, tdefs[i].base); | |
+ gen_tbl ((int)i, minrow, rowcnt, upd_num); | |
+ if (verbose > 0) | |
+ fprintf (stderr, "done.\n"); | |
+ } | |
+ } | |
+ | |
+ return (0); | |
+ } | |
Only in ../tpch-dbgen/: driver.o | |
Only in ../tpch-dbgen/: dss.ddl | |
diff -p third_party/tpch-dbgen/dss.h ../tpch-dbgen/dss.h | |
*** third_party/tpch-dbgen/dss.h 2019-04-16 17:06:26.193072689 +0200 | |
--- ../tpch-dbgen/dss.h 2019-04-16 11:39:42.886691071 +0200 | |
*************** | |
*** 80,86 **** | |
#include "config.h" | |
#include "shared.h" | |
- #include "tpch_dbgen.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
--- 80,85 ---- | |
*************** | |
*** 112,117 **** | |
--- 111,119 ---- | |
#define INTERNAL_ERROR(p) {fprintf(stderr,"%s", p);abort();} | |
#define LN_CNT 4 | |
+ static char lnoise[4] = {'|', '/', '-', '\\' }; | |
+ #define LIFENOISE(n, var) \ | |
+ if (verbose > 0) fprintf(stderr, "%c\b", lnoise[(var%LN_CNT)]) | |
#define MALLOC_CHECK(var) \ | |
if ((var) == NULL) \ | |
*************** | |
*** 139,145 **** | |
#ifndef BITS_PER_LONG | |
#define BITS_PER_LONG 32 | |
#define MAX_LONG 0x7FFFFFFF | |
- #define MIN_LONG (int32_t)0x80000000 | |
#endif /* BITS_PER_LONG */ | |
#define SPARSE_BITS 2 | |
#define SPARSE_KEEP 3 | |
--- 141,146 ---- | |
*************** | |
*** 148,154 **** | |
--- 149,170 ---- | |
#define RANDOM(tgt, lower, upper, stream) dss_random(&tgt, lower, upper, stream) | |
#define RANDOM64(tgt, lower, upper, stream) dss_random64(&tgt, lower, upper, stream) | |
+ | |
+ | |
+ typedef struct | |
+ { | |
+ long weight; | |
+ char *text; | |
+ } set_member; | |
+ | |
+ typedef struct | |
+ { | |
+ int count; | |
+ int max; | |
+ set_member *list; | |
+ long *permute; | |
+ } distribution; | |
/* | |
* some handy access functions | |
*/ | |
*************** void dbg_text PROTO((char * t, int min, | |
*** 225,233 **** | |
--- 241,275 ---- | |
#endif /* DECLARER */ | |
+ EXTERN distribution nations; | |
+ EXTERN distribution nations2; | |
+ EXTERN distribution regions; | |
+ EXTERN distribution o_priority_set; | |
+ EXTERN distribution l_instruct_set; | |
+ EXTERN distribution l_smode_set; | |
+ EXTERN distribution l_category_set; | |
+ EXTERN distribution l_rflag_set; | |
+ EXTERN distribution c_mseg_set; | |
+ EXTERN distribution colors; | |
+ EXTERN distribution p_types_set; | |
+ EXTERN distribution p_cntr_set; | |
+ | |
+ /* distributions that control text generation */ | |
+ EXTERN distribution articles; | |
+ EXTERN distribution nouns; | |
+ EXTERN distribution adjectives; | |
+ EXTERN distribution adverbs; | |
+ EXTERN distribution prepositions; | |
+ EXTERN distribution verbs; | |
+ EXTERN distribution terminators; | |
+ EXTERN distribution auxillaries; | |
+ EXTERN distribution np; | |
+ EXTERN distribution vp; | |
+ EXTERN distribution grammar; | |
EXTERN long scale; | |
+ EXTERN int refresh; | |
EXTERN int resume; | |
EXTERN long verbose; | |
EXTERN long force; | |
Only in ../tpch-dbgen/: dss.ri | |
diff -p third_party/tpch-dbgen/dsstypes.h ../tpch-dbgen/dsstypes.h | |
*** third_party/tpch-dbgen/dsstypes.h 2019-04-16 09:37:49.006642496 +0200 | |
--- ../tpch-dbgen/dsstypes.h 2019-04-16 11:39:42.886691071 +0200 | |
*************** typedef struct | |
*** 128,133 **** | |
--- 128,134 ---- | |
/* parts.c */ | |
long mk_part PROTO((DSS_HUGE index, part_t * p)); | |
+ int pr_part PROTO((part_t * part, int mode)); | |
int ld_part PROTO((part_t * part, int mode)); | |
typedef struct | |
Only in ../tpch-dbgen/: .git | |
Only in ../tpch-dbgen/: .gitignore | |
Only in ../tpch-dbgen/: HISTORY | |
Only in ../tpch-dbgen/: .idea | |
Only in third_party/tpch-dbgen: LICENSE | |
Only in ../tpch-dbgen/: lineitem.tbl | |
Only in ../tpch-dbgen/: load_stub.o | |
Only in ../tpch-dbgen/: makefile | |
Only in ../tpch-dbgen/: makefile.suite | |
Only in ../tpch-dbgen/: nation.tbl | |
Only in ../tpch-dbgen/: orders.tbl | |
Only in ../tpch-dbgen/: partsupp.tbl | |
Only in ../tpch-dbgen/: part.tbl | |
Only in ../tpch-dbgen/: permute.o | |
Only in ../tpch-dbgen/: PORTING.NOTES | |
Only in ../tpch-dbgen/: print.c | |
Only in ../tpch-dbgen/: print.o | |
Only in ../tpch-dbgen/: qgen | |
Only in ../tpch-dbgen/: qgen.c | |
Only in ../tpch-dbgen/: qgen.o | |
Only in ../tpch-dbgen/: qgen.vcproj | |
Only in ../tpch-dbgen/: queries | |
Only in ../tpch-dbgen/: reference | |
Only in ../tpch-dbgen/: region.tbl | |
diff -p third_party/tpch-dbgen/rnd.c ../tpch-dbgen/rnd.c | |
*** third_party/tpch-dbgen/rnd.c 2019-04-16 17:15:36.872136121 +0200 | |
--- ../tpch-dbgen/rnd.c 2019-04-16 11:39:42.890690901 +0200 | |
*************** row_stop(int t) \ | |
*** 125,139 **** | |
for (i=0; i <= MAX_STREAM; i++) | |
if ((Seed[i].table == t) || (Seed[i].table == tdefs[t].child)) | |
! { | |
! // HYRISE: commented out because set_seeds is considered false for us. | |
! // if (set_seeds && (Seed[i].usage > Seed[i].boundary)) | |
! // { | |
! // fprintf(stderr, "\nSEED CHANGE: seed[%d].usage = %ld\n", | |
! // i, Seed[i].usage); | |
! // Seed[i].boundary = Seed[i].usage; | |
! // } | |
! // else | |
{ | |
NthElement((Seed[i].boundary - Seed[i].usage), &Seed[i].value); | |
#ifdef RNG_TEST | |
--- 125,138 ---- | |
for (i=0; i <= MAX_STREAM; i++) | |
if ((Seed[i].table == t) || (Seed[i].table == tdefs[t].child)) | |
! { | |
! if (set_seeds && (Seed[i].usage > Seed[i].boundary)) | |
! { | |
! fprintf(stderr, "\nSEED CHANGE: seed[%d].usage = %ld\n", | |
! i, Seed[i].usage); | |
! Seed[i].boundary = Seed[i].usage; | |
! } | |
! else | |
{ | |
NthElement((Seed[i].boundary - Seed[i].usage), &Seed[i].value); | |
#ifdef RNG_TEST | |
*************** dump_seeds(int tbl) | |
*** 154,160 **** | |
#ifdef RNG_TEST | |
printf("%d(%ld):\t%ld\n", i, Seed[i].nCalls, Seed[i].value); | |
#else | |
! printf("%d:\t%lld\n", i, Seed[i].value); | |
#endif | |
return; | |
} | |
--- 153,159 ---- | |
#ifdef RNG_TEST | |
printf("%d(%ld):\t%ld\n", i, Seed[i].nCalls, Seed[i].value); | |
#else | |
! printf("%d:\t%ld\n", i, Seed[i].value); | |
#endif | |
return; | |
} | |
*************** UnifInt(DSS_HUGE nLow, DSS_HUGE nHigh, l | |
*** 212,223 **** | |
if ((nHigh == MAX_LONG) && (nLow == 0)) | |
{ | |
! // Hyrise: was undefined behaviour, let's make it defined | |
! // dRange = DOUBLE_CAST (nHigh32 - nLow32 + 1); | |
! // nRange = nHigh32 - nLow32 + 1; | |
! dRange = DOUBLE_CAST(MIN_LONG); | |
! nRange = MIN_LONG; | |
! | |
} | |
else | |
{ | |
--- 211,218 ---- | |
if ((nHigh == MAX_LONG) && (nLow == 0)) | |
{ | |
! dRange = DOUBLE_CAST (nHigh32 - nLow32 + 1); | |
! nRange = nHigh32 - nLow32 + 1; | |
} | |
else | |
{ | |
*************** UnifInt(DSS_HUGE nLow, DSS_HUGE nHigh, l | |
*** 233,289 **** | |
return (nLow + nTemp); | |
} | |
- seed_t Seed[MAX_STREAM + 1] = | |
- { | |
- {PART, 1, 0, 1}, /* P_MFG_SD 0 */ | |
- {PART, 46831694, 0, 1}, /* P_BRND_SD 1 */ | |
- {PART, 1841581359, 0, 1}, /* P_TYPE_SD 2 */ | |
- {PART, 1193163244, 0, 1}, /* P_SIZE_SD 3 */ | |
- {PART, 727633698, 0, 1}, /* P_CNTR_SD 4 */ | |
- {NONE, 933588178, 0, 1}, /* text pregeneration 5 */ | |
- {PART, 804159733, 0, 2}, /* P_CMNT_SD 6 */ | |
- {PSUPP, 1671059989, 0, SUPP_PER_PART}, /* PS_QTY_SD 7 */ | |
- {PSUPP, 1051288424, 0, SUPP_PER_PART}, /* PS_SCST_SD 8 */ | |
- {PSUPP, 1961692154, 0, SUPP_PER_PART * 2}, /* PS_CMNT_SD 9 */ | |
- {ORDER, 1227283347, 0, 1}, /* O_SUPP_SD 10 */ | |
- {ORDER, 1171034773, 0, 1}, /* O_CLRK_SD 11 */ | |
- {ORDER, 276090261, 0, 2}, /* O_CMNT_SD 12 */ | |
- {ORDER, 1066728069, 0, 1}, /* O_ODATE_SD 13 */ | |
- {LINE, 209208115, 0, O_LCNT_MAX}, /* L_QTY_SD 14 */ | |
- {LINE, 554590007, 0, O_LCNT_MAX}, /* L_DCNT_SD 15 */ | |
- {LINE, 721958466, 0, O_LCNT_MAX}, /* L_TAX_SD 16 */ | |
- {LINE, 1371272478, 0, O_LCNT_MAX}, /* L_SHIP_SD 17 */ | |
- {LINE, 675466456, 0, O_LCNT_MAX}, /* L_SMODE_SD 18 */ | |
- {LINE, 1808217256, 0, O_LCNT_MAX}, /* L_PKEY_SD 19 */ | |
- {LINE, 2095021727, 0, O_LCNT_MAX}, /* L_SKEY_SD 20 */ | |
- {LINE, 1769349045, 0, O_LCNT_MAX}, /* L_SDTE_SD 21 */ | |
- {LINE, 904914315, 0, O_LCNT_MAX}, /* L_CDTE_SD 22 */ | |
- {LINE, 373135028, 0, O_LCNT_MAX}, /* L_RDTE_SD 23 */ | |
- {LINE, 717419739, 0, O_LCNT_MAX}, /* L_RFLG_SD 24 */ | |
- {LINE, 1095462486, 0, O_LCNT_MAX * 2}, /* L_CMNT_SD 25 */ | |
- {CUST, 881155353, 0, 9}, /* C_ADDR_SD 26 */ | |
- {CUST, 1489529863, 0, 1}, /* C_NTRG_SD 27 */ | |
- {CUST, 1521138112, 0, 3}, /* C_PHNE_SD 28 */ | |
- {CUST, 298370230, 0, 1}, /* C_ABAL_SD 29 */ | |
- {CUST, 1140279430, 0, 1}, /* C_MSEG_SD 30 */ | |
- {CUST, 1335826707, 0, 2}, /* C_CMNT_SD 31 */ | |
- {SUPP, 706178559, 0, 9}, /* S_ADDR_SD 32 */ | |
- {SUPP, 110356601, 0, 1}, /* S_NTRG_SD 33 */ | |
- {SUPP, 884434366, 0, 3}, /* S_PHNE_SD 34 */ | |
- {SUPP, 962338209, 0, 1}, /* S_ABAL_SD 35 */ | |
- {SUPP, 1341315363, 0, 2}, /* S_CMNT_SD 36 */ | |
- {PART, 709314158, 0, 92}, /* P_NAME_SD 37 */ | |
- {ORDER, 591449447, 0, 1}, /* O_PRIO_SD 38 */ | |
- {LINE, 431918286, 0, 1}, /* HVAR_SD 39 */ | |
- {ORDER, 851767375, 0, 1}, /* O_CKEY_SD 40 */ | |
- {NATION, 606179079, 0, 2}, /* N_CMNT_SD 41 */ | |
- {REGION, 1500869201, 0, 2}, /* R_CMNT_SD 42 */ | |
- {ORDER, 1434868289, 0, 1}, /* O_LCNT_SD 43 */ | |
- {SUPP, 263032577, 0, 1}, /* BBB offset 44 */ | |
- {SUPP, 753643799, 0, 1}, /* BBB type 45 */ | |
- {SUPP, 202794285, 0, 1}, /* BBB comment 46 */ | |
- {SUPP, 715851524, 0, 1} /* BBB junk 47 */ | |
- }; | |
- double dM = 2147483647.0; | |
\ No newline at end of file | |
--- 228,232 ---- | |
diff -p third_party/tpch-dbgen/rnd.h ../tpch-dbgen/rnd.h | |
*** third_party/tpch-dbgen/rnd.h 2018-05-11 00:58:51.091846264 +0200 | |
--- ../tpch-dbgen/rnd.h 2019-04-16 11:39:42.890690901 +0200 | |
*************** | |
*** 39,58 **** | |
DSS_HUGE NextRand PROTO((DSS_HUGE)); | |
DSS_HUGE UnifInt PROTO((DSS_HUGE, DSS_HUGE, long)); | |
! //static long nA = 16807; /* the multiplier */ | |
! //static long nM = 2147483647;/* the modulus == 2^31 - 1 */ | |
! //static long nQ = 127773; /* the quotient nM / nA */ | |
! //static long nR = 2836; /* the remainder nM % nA */ | |
! extern double dM; | |
/* | |
* macros to control RNG and assure reproducible multi-stream | |
* runs without the need for seed files. Keep track of invocations of RNG | |
* and always round-up to a known per-row boundary. | |
*/ | |
! /* | |
* preferred solution, but not initializing correctly | |
*/ | |
#define VSTR_MAX(len) (long)(len / 5 + (len % 5 == 0)?0:1 + 1) | |
! extern seed_t Seed[MAX_STREAM + 1]; | |
\ No newline at end of file | |
--- 39,108 ---- | |
DSS_HUGE NextRand PROTO((DSS_HUGE)); | |
DSS_HUGE UnifInt PROTO((DSS_HUGE, DSS_HUGE, long)); | |
! static long nA = 16807; /* the multiplier */ | |
! static long nM = 2147483647;/* the modulus == 2^31 - 1 */ | |
! static long nQ = 127773; /* the quotient nM / nA */ | |
! static long nR = 2836; /* the remainder nM % nA */ | |
! double dM = 2147483647.0; | |
/* | |
* macros to control RNG and assure reproducible multi-stream | |
* runs without the need for seed files. Keep track of invocations of RNG | |
* and always round-up to a known per-row boundary. | |
*/ | |
! /* | |
* preferred solution, but not initializing correctly | |
*/ | |
#define VSTR_MAX(len) (long)(len / 5 + (len % 5 == 0)?0:1 + 1) | |
! seed_t Seed[MAX_STREAM + 1] = | |
! { | |
! {PART, 1, 0, 1}, /* P_MFG_SD 0 */ | |
! {PART, 46831694, 0, 1}, /* P_BRND_SD 1 */ | |
! {PART, 1841581359, 0, 1}, /* P_TYPE_SD 2 */ | |
! {PART, 1193163244, 0, 1}, /* P_SIZE_SD 3 */ | |
! {PART, 727633698, 0, 1}, /* P_CNTR_SD 4 */ | |
! {NONE, 933588178, 0, 1}, /* text pregeneration 5 */ | |
! {PART, 804159733, 0, 2}, /* P_CMNT_SD 6 */ | |
! {PSUPP, 1671059989, 0, SUPP_PER_PART}, /* PS_QTY_SD 7 */ | |
! {PSUPP, 1051288424, 0, SUPP_PER_PART}, /* PS_SCST_SD 8 */ | |
! {PSUPP, 1961692154, 0, SUPP_PER_PART * 2}, /* PS_CMNT_SD 9 */ | |
! {ORDER, 1227283347, 0, 1}, /* O_SUPP_SD 10 */ | |
! {ORDER, 1171034773, 0, 1}, /* O_CLRK_SD 11 */ | |
! {ORDER, 276090261, 0, 2}, /* O_CMNT_SD 12 */ | |
! {ORDER, 1066728069, 0, 1}, /* O_ODATE_SD 13 */ | |
! {LINE, 209208115, 0, O_LCNT_MAX}, /* L_QTY_SD 14 */ | |
! {LINE, 554590007, 0, O_LCNT_MAX}, /* L_DCNT_SD 15 */ | |
! {LINE, 721958466, 0, O_LCNT_MAX}, /* L_TAX_SD 16 */ | |
! {LINE, 1371272478, 0, O_LCNT_MAX}, /* L_SHIP_SD 17 */ | |
! {LINE, 675466456, 0, O_LCNT_MAX}, /* L_SMODE_SD 18 */ | |
! {LINE, 1808217256, 0, O_LCNT_MAX}, /* L_PKEY_SD 19 */ | |
! {LINE, 2095021727, 0, O_LCNT_MAX}, /* L_SKEY_SD 20 */ | |
! {LINE, 1769349045, 0, O_LCNT_MAX}, /* L_SDTE_SD 21 */ | |
! {LINE, 904914315, 0, O_LCNT_MAX}, /* L_CDTE_SD 22 */ | |
! {LINE, 373135028, 0, O_LCNT_MAX}, /* L_RDTE_SD 23 */ | |
! {LINE, 717419739, 0, O_LCNT_MAX}, /* L_RFLG_SD 24 */ | |
! {LINE, 1095462486, 0, O_LCNT_MAX * 2}, /* L_CMNT_SD 25 */ | |
! {CUST, 881155353, 0, 9}, /* C_ADDR_SD 26 */ | |
! {CUST, 1489529863, 0, 1}, /* C_NTRG_SD 27 */ | |
! {CUST, 1521138112, 0, 3}, /* C_PHNE_SD 28 */ | |
! {CUST, 298370230, 0, 1}, /* C_ABAL_SD 29 */ | |
! {CUST, 1140279430, 0, 1}, /* C_MSEG_SD 30 */ | |
! {CUST, 1335826707, 0, 2}, /* C_CMNT_SD 31 */ | |
! {SUPP, 706178559, 0, 9}, /* S_ADDR_SD 32 */ | |
! {SUPP, 110356601, 0, 1}, /* S_NTRG_SD 33 */ | |
! {SUPP, 884434366, 0, 3}, /* S_PHNE_SD 34 */ | |
! {SUPP, 962338209, 0, 1}, /* S_ABAL_SD 35 */ | |
! {SUPP, 1341315363, 0, 2}, /* S_CMNT_SD 36 */ | |
! {PART, 709314158, 0, 92}, /* P_NAME_SD 37 */ | |
! {ORDER, 591449447, 0, 1}, /* O_PRIO_SD 38 */ | |
! {LINE, 431918286, 0, 1}, /* HVAR_SD 39 */ | |
! {ORDER, 851767375, 0, 1}, /* O_CKEY_SD 40 */ | |
! {NATION, 606179079, 0, 2}, /* N_CMNT_SD 41 */ | |
! {REGION, 1500869201, 0, 2}, /* R_CMNT_SD 42 */ | |
! {ORDER, 1434868289, 0, 1}, /* O_LCNT_SD 43 */ | |
! {SUPP, 263032577, 0, 1}, /* BBB offset 44 */ | |
! {SUPP, 753643799, 0, 1}, /* BBB type 45 */ | |
! {SUPP, 202794285, 0, 1}, /* BBB comment 46 */ | |
! {SUPP, 715851524, 0, 1} /* BBB junk 47 */ | |
! }; | |
Only in ../tpch-dbgen/: rnd.o | |
Only in ../tpch-dbgen/: rng64.o | |
diff -p third_party/tpch-dbgen/speed_seed.c ../tpch-dbgen/speed_seed.c | |
*** third_party/tpch-dbgen/speed_seed.c 2018-05-11 00:58:51.091846264 +0200 | |
--- ../tpch-dbgen/speed_seed.c 2019-04-16 11:39:42.890690901 +0200 | |
*************** extern seed_t Seed[]; | |
*** 66,72 **** | |
void fakeVStr(int nAvg, long nSeed, DSS_HUGE nCount); | |
void NthElement (DSS_HUGE N, DSS_HUGE *StartSeed); | |
- static char lnoise[4] = {'|', '/', '-', '\\' }; | |
void | |
advanceStream(int nStream, DSS_HUGE nCalls, int bUse64Bit) | |
--- 66,71 ---- | |
Only in ../tpch-dbgen/: speed_seed.o | |
Only in ../tpch-dbgen/: supplier.tbl | |
Only in ../tpch-dbgen/: tests | |
diff -p third_party/tpch-dbgen/text.c ../tpch-dbgen/text.c | |
*** third_party/tpch-dbgen/text.c 2019-04-16 17:17:08.599503486 +0200 | |
--- ../tpch-dbgen/text.c 2019-04-16 11:39:42.890690901 +0200 | |
*************** next_token: /* I hate goto's, but can't | |
*** 253,260 **** | |
case 'P': | |
i = pick_str(&prepositions, sd, dest); | |
len = (int)strlen(DIST_MEMBER(&prepositions, i)); | |
! // HYRISE: Avoid redundantly figuring out the string length - use memcpy over strcpy | |
! memcpy((dest + len), " the ", 5); | |
len += 5; | |
len += txt_np(dest + len, sd); | |
break; | |
--- 253,259 ---- | |
case 'P': | |
i = pick_str(&prepositions, sd, dest); | |
len = (int)strlen(DIST_MEMBER(&prepositions, i)); | |
! strcpy((dest + len), " the "); | |
len += 5; | |
len += txt_np(dest + len, sd); | |
break; | |
*************** dbg_text(char *tgt, int min, int max, in | |
*** 317,324 **** | |
needed = TEXT_POOL_SIZE - wordlen; | |
if (needed >= (s_len + 1)) /* need the entire sentence */ | |
{ | |
! // HYRISE: Avoid redundantly figuring out the string length - use memcpy over strcpy | |
! memcpy(cp, sentence, s_len); | |
cp += s_len; | |
wordlen += s_len + 1; | |
*(cp++) = ' '; | |
--- 316,322 ---- | |
needed = TEXT_POOL_SIZE - wordlen; | |
if (needed >= (s_len + 1)) /* need the entire sentence */ | |
{ | |
! strcpy(cp, sentence); | |
cp += s_len; | |
wordlen += s_len + 1; | |
*(cp++) = ' '; | |
*************** dbg_text(char *tgt, int min, int max, in | |
*** 326,333 **** | |
else /* chop the new sentence off to match the length target */ | |
{ | |
sentence[needed] = '\0'; | |
! // HYRISE: Avoid redundantly figuring out the string length - use memcpy over strcpy | |
! memcpy(cp, sentence, needed); | |
wordlen += needed; | |
cp += needed; | |
} | |
--- 324,330 ---- | |
else /* chop the new sentence off to match the length target */ | |
{ | |
sentence[needed] = '\0'; | |
! strcpy(cp, sentence); | |
wordlen += needed; | |
cp += needed; | |
} | |
*************** dbg_text(char *tgt, int min, int max, in | |
*** 340,347 **** | |
RANDOM(hgOffset, 0, TEXT_POOL_SIZE - max, sd); | |
RANDOM(hgLength, min, max, sd); | |
! // HYRISE: Avoid redundantly figuring out the string length - use memcpy over strcpy | |
! memcpy(&tgt[0], &szTextPool[hgOffset], (int)hgLength); | |
tgt[hgLength] = '\0'; | |
return; | |
--- 337,343 ---- | |
RANDOM(hgOffset, 0, TEXT_POOL_SIZE - max, sd); | |
RANDOM(hgLength, min, max, sd); | |
! strncpy(&tgt[0], &szTextPool[hgOffset], (int)hgLength); | |
tgt[hgLength] = '\0'; | |
return; | |
Only in ../tpch-dbgen/: text.o | |
Only in ../tpch-dbgen/: tpcd.h | |
Only in third_party/tpch-dbgen: tpch_dbgen.c | |
Only in third_party/tpch-dbgen: tpch_dbgen.h | |
Only in ../tpch-dbgen/: tpch.dsw | |
Only in ../tpch-dbgen/: tpch.sln | |
Only in ../tpch-dbgen/: tpch.vcproj | |
Only in ../tpch-dbgen/: variants | |
Only in ../tpch-dbgen/: varsub.c | |
Only in ../tpch-dbgen/: varsub.o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment