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(org.apache.flink.api.common.typeutils.TypeSerializer<T> buildSideSerializer,
org.apache.flink.api.common.typeutils.TypeComparator<T> buildSideComparator,
List<org.apache.flink.core.memory.MemorySegment> memorySegments) |
CompactingHashTable(org.apache.flink.api.common.typeutils.TypeSerializer<T> buildSideSerializer,
org.apache.flink.api.common.typeutils.TypeComparator<T> buildSideComparator,
List<org.apache.flink.core.memory.MemorySegment> memorySegments,
int avgRecordLen) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort() |
void |
buildTableWithUniqueKey(org.apache.flink.util.MutableObjectIterator<T> input) |
void |
close()
Closes the hash table.
|
org.apache.flink.util.MutableObjectIterator<T> |
getEntryIterator() |
List<org.apache.flink.core.memory.MemorySegment> |
getFreeMemory() |
<PT> CompactingHashTable.HashTableProber<PT> |
getProber(org.apache.flink.api.common.typeutils.TypeComparator<PT> probeSideComparator,
org.apache.flink.api.common.typeutils.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, getBuildSideSerializerpublic CompactingHashTable(org.apache.flink.api.common.typeutils.TypeSerializer<T> buildSideSerializer, org.apache.flink.api.common.typeutils.TypeComparator<T> buildSideComparator, List<org.apache.flink.core.memory.MemorySegment> memorySegments)
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<org.apache.flink.core.memory.MemorySegment> getFreeMemory()
getFreeMemory in class AbstractMutableHashTable<T>public void buildTableWithUniqueKey(org.apache.flink.util.MutableObjectIterator<T> input) throws IOException
IOExceptionpublic final void insert(T record) throws IOException
insert in class AbstractMutableHashTable<T>IOExceptionpublic void insertOrReplaceRecord(T record) throws IOException
insertOrReplaceRecord in class AbstractMutableHashTable<T>record - record to insert or replaceIOExceptionpublic <PT> CompactingHashTable.HashTableProber<PT> getProber(org.apache.flink.api.common.typeutils.TypeComparator<PT> probeSideComparator, org.apache.flink.api.common.typeutils.TypePairComparator<PT,T> pairComparator)
getProber in class AbstractMutableHashTable<T>public org.apache.flink.util.MutableObjectIterator<T> getEntryIterator()
getEntryIterator in class AbstractMutableHashTable<T>CompactingHashTable.EntryIteratorCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.