K
- type of the map key.V
- type of the map value.public abstract class BytesMap<K,V> extends Object
BytesHashMap
.Modifier and Type | Class and Description |
---|---|
static class |
BytesMap.LookupInfo<K,V>
Result fetched when looking up a key.
|
Modifier and Type | Field and Description |
---|---|
static int |
BUCKET_SIZE |
protected static int |
BUCKET_SIZE_BITS |
protected List<MemorySegment> |
bucketSegments |
protected static int |
ELEMENT_POINT_LENGTH |
protected static int |
END_OF_LIST |
protected int |
growthThreshold
The map will be expanded once the number of elements exceeds this threshold.
|
protected static long |
INIT_BUCKET_MEMORY_IN_BYTES |
protected int |
lastBucketPosition |
protected static double |
LOAD_FACTOR |
protected int |
log2NumBuckets |
protected MemorySegmentPool |
memoryPool |
protected int |
numBucketsMask |
protected int |
numBucketsMask2 |
protected int |
numBucketsPerSegment |
protected int |
numBucketsPerSegmentBits |
protected int |
numBucketsPerSegmentMask |
protected int |
numElements |
protected long |
numSpillFiles |
static int |
RECORD_EXTRA_LENGTH |
protected org.apache.paimon.hash.BytesMap.RecordArea<K,V> |
recordArea
The segments where the actual data is stored.
|
protected int |
reservedNumBuffers |
protected K |
reusedKey
Used as a reused object when lookup and iteration.
|
protected V |
reusedValue
Used as a reused object when retrieve the map's value by key and iteration.
|
protected int |
segmentSize |
protected long |
spillInBytes |
protected static int |
STEP_INCREMENT |
Constructor and Description |
---|
BytesMap(MemorySegmentPool memoryPool,
PagedTypeSerializer<K> keySerializer) |
Modifier and Type | Method and Description |
---|---|
protected int |
calcSecondHashCode(int firstHashCode) |
void |
free() |
int |
getNumElements() |
abstract long |
getNumKeys()
Returns the number of keys in this map.
|
long |
getNumSpillFiles() |
long |
getSpillInBytes() |
protected void |
growAndRehash() |
protected void |
initBucketSegments(int numBucketSegments) |
BytesMap.LookupInfo<K,V> |
lookup(K key) |
void |
reset()
reset the map's record and bucket area's memory segments for reusing.
|
protected void |
resetBucketSegments(List<MemorySegment> resetBucketSegs) |
protected void |
returnSegments(List<MemorySegment> segments) |
public static final int BUCKET_SIZE
protected static final int END_OF_LIST
protected static final int STEP_INCREMENT
protected static final int ELEMENT_POINT_LENGTH
public static final int RECORD_EXTRA_LENGTH
protected static final int BUCKET_SIZE_BITS
protected final int numBucketsPerSegment
protected final int numBucketsPerSegmentBits
protected final int numBucketsPerSegmentMask
protected final int lastBucketPosition
protected final int segmentSize
protected final MemorySegmentPool memoryPool
protected List<MemorySegment> bucketSegments
protected final int reservedNumBuffers
protected int numElements
protected int numBucketsMask
protected int log2NumBuckets
protected int numBucketsMask2
protected static final double LOAD_FACTOR
protected static final long INIT_BUCKET_MEMORY_IN_BYTES
protected int growthThreshold
protected org.apache.paimon.hash.BytesMap.RecordArea<K,V> recordArea
protected K reusedKey
protected V reusedValue
protected long numSpillFiles
protected long spillInBytes
public BytesMap(MemorySegmentPool memoryPool, PagedTypeSerializer<K> keySerializer)
public abstract long getNumKeys()
protected void initBucketSegments(int numBucketSegments)
protected void resetBucketSegments(List<MemorySegment> resetBucketSegs)
public long getNumSpillFiles()
public long getSpillInBytes()
public int getNumElements()
public void free()
public void reset()
public BytesMap.LookupInfo<K,V> lookup(K key)
key
- by which looking up the value in the hash map. Only support the key in the
BinaryRowData form who has only one MemorySegment.BytesMap.LookupInfo
protected void growAndRehash() throws EOFException
EOFException
- if the map can't allocate much more memory.protected void returnSegments(List<MemorySegment> segments)
protected int calcSecondHashCode(int firstHashCode)
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.