Multi-core Hash Joins
Main-memory hash join implementations for multi-core CPUs
Functions
Data Set Generation

Functions

void seed_generator (unsigned int seed)
 
int create_relation_nonunique (relation_t *reln, int64_t ntuples, const int64_t maxid)
 
int create_relation_pk (relation_t *reln, int64_t ntuples)
 
int create_relation_fk (relation_t *reln, int64_t ntuples, const int64_t maxid)
 
int create_relation_fk_from_pk (relation_t *fkrel, relation_t *pkrel, int64_t ntuples)
 
int create_relation_zipf (relation_t *reln, int64_t ntuples, const int64_t maxid, const double zipfparam)
 
int parallel_create_relation (relation_t *reln, uint64_t ntuples, uint32_t nthreads, uint64_t maxid)
 
int parallel_create_relation_fk (relation_t *reln, int64_t ntuples, const int64_t maxid, uint32_t nthreads)
 
void delete_relation (relation_t *reln)
 
int numa_localize (tuple_t *relation, int64_t num_tuples, uint32_t nthreads)
 
void write_relation (relation_t *rel, char *filename)
 
int load_relation (relation_t *relation, char *filename, uint64_t num_tuples)
 

Detailed Description

Function Documentation

◆ create_relation_fk()

int create_relation_fk ( relation_t reln,
int64_t  ntuples,
const int64_t  maxid 
)

Create relation with foreign keys (i.e. duplicated keys exist). If ntuples is an exact multiple of maxid, (ntuples/maxid) sub-relations with shuffled keys following each other are generated.

Definition at line 468 of file generator.c.

◆ create_relation_fk_from_pk()

int create_relation_fk_from_pk ( relation_t fkrel,
relation_t pkrel,
int64_t  num_tuples 
)

Create a foreign-key relation using the given primary-key relation and foreign-key relation size. If the keys in pkrel is randomly distributed in the full integer range, then

Create a foreign-key relation using the given primary-key relation and foreign-key relation size. Keys in pkrel is randomly distributed in the full integer range.

Parameters
fkrel[output] foreign-key relation
pkrel[input] primary-key relation
num_tuples
Returns

Definition at line 519 of file generator.c.

◆ create_relation_nonunique()

int create_relation_nonunique ( relation_t reln,
int64_t  ntuples,
const int64_t  maxid 
)

Create relation with non-unique keys uniformly distributed between [0, maxid]

Definition at line 554 of file generator.c.

◆ create_relation_pk()

int create_relation_pk ( relation_t reln,
int64_t  ntuples 
)

Create relation with only primary keys (i.e. keys are unique from 1 to num_tuples)

Definition at line 270 of file generator.c.

◆ create_relation_zipf()

int create_relation_zipf ( relation_t reln,
int64_t  ntuples,
const int64_t  maxid,
const double  zipfparam 
)

Create relation with keys distributed with zipf between [0, maxid]

  • zipf_param is the parameter of zipf distr (aka s)
  • maxid is equivalent to the alphabet size

Definition at line 583 of file generator.c.

◆ delete_relation()

void delete_relation ( relation_t reln)

Free memory allocated for only tuples.

Definition at line 602 of file generator.c.

◆ load_relation()

int load_relation ( relation_t relation,
char *  filename,
uint64_t  num_tuples 
)

Load a relation from given file name

Definition at line 394 of file generator.c.

◆ numa_localize()

int numa_localize ( tuple_t relation,
int64_t  num_tuples,
uint32_t  nthreads 
)

This is just to make sure that chunks of the temporary memory will be numa local to threads. Just initialize memory to 0 for making sure it will be allocated numa-local.

Definition at line 413 of file generator.c.

◆ parallel_create_relation()

int parallel_create_relation ( relation_t reln,
uint64_t  ntuples,
uint32_t  nthreads,
uint64_t  maxid 
)

Create relation with only primary keys (i.e. keys are unique from 1 to maxid). Creation procedure is executed by nthreads in parallel, where each memory is initialized thread local.

Definition at line 293 of file generator.c.

◆ parallel_create_relation_fk()

int parallel_create_relation_fk ( relation_t reln,
int64_t  ntuples,
const int64_t  maxid,
uint32_t  nthreads 
)

Create relation with foreign keys (i.e. duplicated keys exist). If ntuples is an exact multiple of maxid, (ntuples/maxid) sub-relations with shuffled keys following each other are generated. Creation procedure is executed by nthreads in parallel, where each memory is initialized thread local.

◆ seed_generator()

void seed_generator ( unsigned int  seed)

Seed the random number generator before calling create_relation_xx. If not called, then generator will be initialized with the time of the call which produces different random numbers from run to run.

Definition at line 77 of file generator.c.

◆ write_relation()

void write_relation ( relation_t rel,
char *  filename 
)

Write relation to a file.

Definition at line 240 of file generator.c.