Class LongHybridHashTable
- java.lang.Object
-
- org.apache.flink.table.runtime.hashtable.BaseHybridHashTable
-
- org.apache.flink.table.runtime.hashtable.LongHybridHashTable
-
- All Implemented Interfaces:
MemorySegmentSource
,MemorySegmentPool
public abstract class LongHybridHashTable extends BaseHybridHashTable
Special optimized hashTable with key long.See
LongHashPartition
. TODO add min max long filter and bloomFilter to spilled partition.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.table.runtime.hashtable.BaseHybridHashTable
buildRowCount, buildSpillRetBufferNumbers, buildSpillReturnBuffers, closed, compressionBlockSize, compressionCodecFactory, compressionEnabled, currentEnumerator, currentRecursionDepth, currentSpilledBuildSide, currentSpilledProbeSide, initPartitionFanOut, internalPool, ioManager, LOG, MAX_NUM_PARTITIONS, MAX_RECURSION_DEPTH, numSpillFiles, segmentSize, segmentSizeBits, segmentSizeMask, spillInBytes, totalNumBuffers, tryDistinctBuildRow
-
-
Constructor Summary
Constructors Constructor Description LongHybridHashTable(Object owner, boolean compressionEnabled, int compressionBlockSize, BinaryRowDataSerializer buildSideSerializer, BinaryRowDataSerializer probeSideSerializer, MemoryManager memManager, long reservedMemorySize, IOManager ioManager, int avgRecordLen, long buildRowCount)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
clearPartitions()
void
close()
Closes the hash table.int
compressionBlockSize()
BlockCompressionFactory
compressionCodecFactory()
boolean
compressionEnabled()
void
endBuild()
void
free()
RowIterator<BinaryRowData>
get(long probeKey)
This method is only used for operator fusion codegen to get build row from hash table.abstract long
getBuildLongKey(RowData row)
For code gen get build side long key.LongHashPartition.MatchIterator
getBuildSideIterator()
RowData
getCurrentProbeRow()
List<LongHashPartition>
getPartitionsPendingForSMJ()
abstract long
getProbeLongKey(RowData row)
For code gen get probe side long key.RowIterator
getSpilledPartitionBuildSideIter(LongHashPartition p)
ProbeIterator
getSpilledPartitionProbeSideIter(LongHashPartition p)
void
insertIntoProbeBuffer(RowData probeRecord)
If the probe row corresponding partition has been spilled to disk, just call this method spill probe row to disk.boolean
nextMatching()
abstract BinaryRowData
probeToBinary(RowData row)
For code gen probe side to BinaryRowData.void
putBuildRow(BinaryRowData row)
int
spillPartition()
boolean
tryProbe(RowData record)
-
Methods inherited from class org.apache.flink.table.runtime.hashtable.BaseHybridHashTable
createInputView, ensureNumBuffersReturned, freeCurrent, freePages, getNextBuffer, getNextBuffers, getNotNullNextBuffer, getNumSpillFiles, getSpillInBytes, getUsedMemoryInBytes, hash, maxInitBufferOfBucketArea, maxNumPartition, nextSegment, pageSize, readAllBuffers, releaseMemoryCacheForSMJ, remainBuffers, returnAll, returnPage
-
-
-
-
Constructor Detail
-
LongHybridHashTable
public LongHybridHashTable(Object owner, boolean compressionEnabled, int compressionBlockSize, BinaryRowDataSerializer buildSideSerializer, BinaryRowDataSerializer probeSideSerializer, MemoryManager memManager, long reservedMemorySize, IOManager ioManager, int avgRecordLen, long buildRowCount)
-
-
Method Detail
-
putBuildRow
public void putBuildRow(BinaryRowData row) throws IOException
- Throws:
IOException
-
endBuild
public void endBuild() throws IOException
- Throws:
IOException
-
get
@Nullable public final RowIterator<BinaryRowData> get(long probeKey) throws IOException
This method is only used for operator fusion codegen to get build row from hash table. If the build partition has spilled to disk, return null directly which requires the join operator also spill probe row to disk.- Throws:
IOException
-
insertIntoProbeBuffer
public final void insertIntoProbeBuffer(RowData probeRecord) throws IOException
If the probe row corresponding partition has been spilled to disk, just call this method spill probe row to disk.Note: This must be called only after
get(long)
method.- Throws:
IOException
-
tryProbe
public boolean tryProbe(RowData record) throws IOException
- Throws:
IOException
-
nextMatching
public boolean nextMatching() throws IOException
- Throws:
IOException
-
getCurrentProbeRow
public RowData getCurrentProbeRow()
-
getBuildSideIterator
public LongHashPartition.MatchIterator getBuildSideIterator()
-
close
public void close()
Description copied from class:BaseHybridHashTable
Closes the hash table. This effectively releases all internal structures and closes all open files and removes them. The call to this method is valid both as a cleanup after the complete inputs were properly processed, and as an cancellation call, which cleans up all resources that are currently held by the hash join.- Overrides:
close
in classBaseHybridHashTable
-
free
public void free()
- Overrides:
free
in classBaseHybridHashTable
-
getBuildLongKey
public abstract long getBuildLongKey(RowData row)
For code gen get build side long key.
-
getProbeLongKey
public abstract long getProbeLongKey(RowData row)
For code gen get probe side long key.
-
probeToBinary
public abstract BinaryRowData probeToBinary(RowData row)
For code gen probe side to BinaryRowData.
-
spillPartition
public int spillPartition() throws IOException
- Specified by:
spillPartition
in classBaseHybridHashTable
- Throws:
IOException
-
getPartitionsPendingForSMJ
public List<LongHashPartition> getPartitionsPendingForSMJ()
-
getSpilledPartitionBuildSideIter
public RowIterator getSpilledPartitionBuildSideIter(LongHashPartition p) throws IOException
- Throws:
IOException
-
getSpilledPartitionProbeSideIter
public ProbeIterator getSpilledPartitionProbeSideIter(LongHashPartition p) throws IOException
- Throws:
IOException
-
clearPartitions
protected void clearPartitions()
- Specified by:
clearPartitions
in classBaseHybridHashTable
-
compressionEnabled
public boolean compressionEnabled()
-
compressionCodecFactory
public BlockCompressionFactory compressionCodecFactory()
-
compressionBlockSize
public int compressionBlockSize()
-
-