T - Record type stored in hash tablepublic class CompactingHashTable<T> extends AbstractMutableHashTable<T>
The design of this class follows on many parts the design presented in "Hash joins and hash teams in Microsoft SQL Server", by Goetz Graefe et al..
+----------------------------- Bucket x ---------------------------- |Partition (1 byte) | reserved (3 bytes) | element count (4 bytes) | | next-bucket-in-chain-pointer (8 bytes) | | |hashCode 1 (4 bytes) | hashCode 2 (4 bytes) | hashCode 3 (4 bytes) | | ... hashCode n-1 (4 bytes) | hashCode n (4 bytes) | |pointer 1 (8 bytes) | pointer 2 (8 bytes) | pointer 3 (8 bytes) | | ... pointer n-1 (8 bytes) | pointer n (8 bytes) | +---------------------------- Bucket x + 1-------------------------- |Partition (1 byte) | reserved (3 bytes) | element count (4 bytes) | | next-bucket-in-chain-pointer (8 bytes) | | |hashCode 1 (4 bytes) | hashCode 2 (4 bytes) | hashCode 3 (4 bytes) | | ... hashCode n-1 (4 bytes) | hashCode n (4 bytes) | |pointer 1 (8 bytes) | pointer 2 (8 bytes) | pointer 3 (8 bytes) | | ... pointer n-1 (8 bytes) | pointer n (8 bytes) +------------------------------------------------------------------- | ... |
| Modifier and Type | Class and Description |
|---|---|
class |
CompactingHashTable.EntryIterator
Iterator that traverses the whole hash table once
If entries are inserted during iteration they may be overlooked by the iterator
|
class |
CompactingHashTable.HashTableProber<PT> |
buildSideComparator, buildSideSerializer| Constructor and Description |
|---|
CompactingHashTable(TypeSerializer<T> buildSideSerializer,
TypeComparator<T> buildSideComparator,
List<MemorySegment> memorySegments) |
CompactingHashTable(TypeSerializer<T> buildSideSerializer,
TypeComparator<T> buildSideComparator,
List<MemorySegment> memorySegments,
int avgRecordLen) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort() |
void |
buildTable(MutableObjectIterator<T> input) |
void |
close()
Closes the hash table.
|
MutableObjectIterator<T> |
getEntryIterator() |
List<MemorySegment> |
getFreeMemory() |
<PT> CompactingHashTable.HashTableProber<PT> |
getProber(TypeComparator<PT> probeSideComparator,
TypePairComparator<PT,T> pairComparator) |
void |
insert(T record) |
void |
insertOrReplaceRecord(T record,
T tempHolder)
Replaces record in hash table if record already present or append record if not.
|
void |
open()
Build the hash table
|
getBuildSideComparator, getBuildSideSerializerpublic CompactingHashTable(TypeSerializer<T> buildSideSerializer, TypeComparator<T> buildSideComparator, List<MemorySegment> memorySegments)
public CompactingHashTable(TypeSerializer<T> buildSideSerializer, TypeComparator<T> buildSideComparator, List<MemorySegment> memorySegments, int avgRecordLen)
public void open()
open in class AbstractMutableHashTable<T>public void close()
close in class AbstractMutableHashTable<T>public void abort()
abort in class AbstractMutableHashTable<T>public List<MemorySegment> getFreeMemory()
getFreeMemory in class AbstractMutableHashTable<T>public void buildTable(MutableObjectIterator<T> input) throws IOException
buildTable in class AbstractMutableHashTable<T>IOExceptionpublic final void insert(T record) throws IOException
insert in class AbstractMutableHashTable<T>IOExceptionpublic <PT> CompactingHashTable.HashTableProber<PT> getProber(TypeComparator<PT> probeSideComparator, TypePairComparator<PT,T> pairComparator)
getProber in class AbstractMutableHashTable<T>PT - The type of the probe side.public MutableObjectIterator<T> getEntryIterator()
getEntryIterator in class AbstractMutableHashTable<T>CompactingHashTable.EntryIteratorpublic void insertOrReplaceRecord(T record, T tempHolder) throws IOException
insertOrReplaceRecord in class AbstractMutableHashTable<T>record - record to insert or replacetempHolder - instance of T that will be overwrittenIOExceptionCopyright © 2014 The Apache Software Foundation. All rights reserved.