-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoin.h
53 lines (45 loc) · 1.37 KB
/
join.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <stdlib.h>
#include <ctime>
#include <cstring>
#include <stdio.h>
#include <fstream>
#include <vector>
#include <stdint.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "job.h"
using namespace std;
#ifndef JOIN_H
#define JOIN_H
#define n_last_digits 3 //number of last digits for hash function 1
#define divisor 13 //hash function 2 mod value
// globals
extern int numofbuckets;
extern JobScheduler *jobScheduler;
struct ColStats{
int l; // minimum value of collumn
int u; // max value
int f; // number of entries
int d; // number of distinct values
};
class relation{
public:
uint64_t **cols;
ColStats **colStats;
ColStats **tempcolStats;
int numofcols;
int numofentries;
};
uint64_t dec_to_bin(uint64_t decimal);
int hashvalue(uint64_t num,int divider);
int getnumofentries(char* file_name);
relation** init_relations(int *numofrels);
void sort_hashtable(uint64_t *col,int numofentries,Tuple** hash,int** hist,int** psum);
int hashfun2(int value);
void create_indexing(int numofentries,Tuple *table,int* hist, int** chain, int** bucket);
list* getResults(int numofentries,Tuple *A,int *A_hist,Tuple *B,int *chain, int *bucket,int biggestTable);
void free_memory(Tuple** hash,int** hist,int** psum);
list* RadixHashJoin(uint64_t* A, int A_size, uint64_t* B, int B_size);
#endif