Class BytesMap<K,V>
java.lang.Object
org.apache.flink.table.runtime.util.collections.binary.BytesMap<K,V>
- Type Parameters:
K- type of the map key.V- type of the map value.
- Direct Known Subclasses:
AbstractBytesHashMap,AbstractBytesMultiMap
Base class for
BytesHashMap and BytesMultiMap.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classResult fetched when looking up a key. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected static final intprotected List<org.apache.flink.core.memory.MemorySegment>protected static final intprotected static final intprotected intThe map will be expanded once the number of elements exceeds this threshold.protected static final longprotected final intprotected static final doubleprotected intprotected final LazyMemorySegmentPoolprotected intprotected intprotected final intprotected final intprotected final intprotected longprotected longstatic final intThe segments where the actual data is stored.protected final intprotected KUsed as a reused object when lookup and iteration.protected VUsed as a reused object when retrieve the map's value by key and iteration.protected final intprotected longprotected static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intcalcSecondHashCode(int firstHashCode) voidfree(boolean reservedRecordMemory) longabstract longReturns the number of keys in this map.longlongprotected voidprotected voidinitBucketSegments(int numBucketSegments) voidreset()reset the map's record and bucket area's memory segments for reusing.protected voidresetBucketSegments(List<org.apache.flink.core.memory.MemorySegment> resetBucketSegs) protected voidreturnSegments(List<org.apache.flink.core.memory.MemorySegment> segments)
-
Field Details
-
BUCKET_SIZE
public static final int BUCKET_SIZE- See Also:
-
END_OF_LIST
protected static final int END_OF_LIST- See Also:
-
STEP_INCREMENT
protected static final int STEP_INCREMENT- See Also:
-
ELEMENT_POINT_LENGTH
protected static final int ELEMENT_POINT_LENGTH- See Also:
-
RECORD_EXTRA_LENGTH
public static final int RECORD_EXTRA_LENGTH- See Also:
-
BUCKET_SIZE_BITS
protected static final int BUCKET_SIZE_BITS- See Also:
-
numBucketsPerSegment
protected final int numBucketsPerSegment -
numBucketsPerSegmentBits
protected final int numBucketsPerSegmentBits -
numBucketsPerSegmentMask
protected final int numBucketsPerSegmentMask -
lastBucketPosition
protected final int lastBucketPosition -
segmentSize
protected final int segmentSize -
memoryPool
-
bucketSegments
-
reservedNumBuffers
protected final int reservedNumBuffers -
numElements
protected long numElements -
numBucketsMask
protected int numBucketsMask -
log2NumBuckets
protected int log2NumBuckets -
numBucketsMask2
protected int numBucketsMask2 -
LOAD_FACTOR
protected static final double LOAD_FACTOR- See Also:
-
INIT_BUCKET_MEMORY_IN_BYTES
protected static final long INIT_BUCKET_MEMORY_IN_BYTES- See Also:
-
growthThreshold
protected int growthThresholdThe map will be expanded once the number of elements exceeds this threshold. -
recordArea
protected org.apache.flink.table.runtime.util.collections.binary.BytesMap.RecordArea<K,V> recordAreaThe segments where the actual data is stored. -
reusedKey
Used as a reused object when lookup and iteration. -
reusedValue
Used as a reused object when retrieve the map's value by key and iteration. -
numSpillFiles
protected long numSpillFiles -
spillInBytes
protected long spillInBytes
-
-
Constructor Details
-
BytesMap
-
-
Method Details
-
getNumKeys
public abstract long getNumKeys()Returns the number of keys in this map. -
initBucketSegments
protected void initBucketSegments(int numBucketSegments) -
resetBucketSegments
protected void resetBucketSegments(List<org.apache.flink.core.memory.MemorySegment> resetBucketSegs) -
getNumSpillFiles
public long getNumSpillFiles() -
getSpillInBytes
public long getSpillInBytes() -
getNumElements
public long getNumElements() -
free
public void free(boolean reservedRecordMemory) - Parameters:
reservedRecordMemory- reserved fixed memory or not.
-
reset
public void reset()reset the map's record and bucket area's memory segments for reusing. -
lookup
- Parameters:
key- by which looking up the value in the hash map. Only support the key in the BinaryRowData form who has only one MemorySegment.- Returns:
BytesMap.LookupInfo
-
growAndRehash
- Throws:
EOFException- if the map can't allocate much more memory.
-
returnSegments
-
calcSecondHashCode
protected int calcSecondHashCode(int firstHashCode)
-