pub type JoinHashMap<K> = HashMap<K, RowId, PrecomputedBuildHasher, MonitoredGlobalAlloc>;
Expand description
In JoinHashMap
, we only save the row id of the first build row that has the hash key.
In fact, in the build side there may be multiple rows with the same hash key. To handle this
case, we use ChunkedData
to link them together. For example:
id | key | row |
---|---|---|
0 | 1 | (1, 2, 3) |
1 | 4 | (4, 5, 6) |
2 | 1 | (1, 3, 7) |
3 | 1 | (1, 3, 2) |
4 | 3 | (3, 2, 1) |
The corresponding join hash map is:
key | value |
---|---|
1 | 0 |
4 | 1 |
3 | 4 |
And we save build rows with the same key like this:
id | value |
---|---|
0 | 2 |
1 | None |
2 | 3 |
3 | None |
4 | None |
This can be seen as an implicit linked list. For convenience, we use RowIdIter
to iterate all
build side row ids with the given key.
Aliased Typeยง
struct JoinHashMap<K> { /* private fields */ }