-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoinHT.h
More file actions
40 lines (32 loc) · 970 Bytes
/
Copy pathjoinHT.h
File metadata and controls
40 lines (32 loc) · 970 Bytes
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
class joinHashTbl
{
private:
union JAttrType
{
int iValue;
float fValue;
char* sValue;
};
struct joinhashBucket
{
union JAttrType attrValue;
RID rid;
joinhashBucket* next; // next node in the hash table
};
struct HTentry
{
int bucketCnt; // nuumber of buckets on this chain
joinhashBucket* chain; // pointer to first bucket on the chain
};
AttrDesc joinAttr;
int HTSIZE;
HTentry *ht; // actual hash table
int hash(const char* attr, int attrType); // returns value between 0 and HTSIZE-1
public:
joinHashTbl(const int size, const AttrDesc attr); // constructor
~joinHashTbl();
// insert a new (JoinAttrValue, RID) pair into hash table
Status insert(const RID newRid, const char* tuple);
// get RIDs of records whose join attribute value matches innerJoinAttrValue
Status lookup(const char* innerJoinAttrPtr, int & ridCount, RID *&outRids);
};