T
- Record type stored in hash tablepublic class CompactingHashTable<T> extends AbstractMutableHashTable<T>
MutableHashTable
.
The hash table is internally divided into two parts: The hash index, and the partition buffers that store the actual records. When records are inserted or updated, the hash table appends the records to its corresponding partition, and inserts or updates the entry in the hash index. In the case that the hash table runs out of memory, it compacts a partition by walking through the hash index and copying all reachable elements into a fresh partition. After that, it releases the memory of the partition to compact.
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, closed, stateLock
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 |
buildTableWithUniqueKey(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)
Replaces record in hash table if record already present or append record if not.
|
void |
open()
Initialize the hash table
|
getBuildSideComparator, getBuildSideSerializer
public 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 buildTableWithUniqueKey(MutableObjectIterator<T> input) throws IOException
IOException
public final void insert(T record) throws IOException
insert
in class AbstractMutableHashTable<T>
IOException
public void insertOrReplaceRecord(T record) throws IOException
insertOrReplaceRecord
in class AbstractMutableHashTable<T>
record
- record to insert or replaceIOException
public <PT> CompactingHashTable.HashTableProber<PT> getProber(TypeComparator<PT> probeSideComparator, TypePairComparator<PT,T> pairComparator)
getProber
in class AbstractMutableHashTable<T>
public MutableObjectIterator<T> getEntryIterator()
getEntryIterator
in class AbstractMutableHashTable<T>
CompactingHashTable.EntryIterator
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.