public abstract class AbstractBytesHashMap<K> extends BytesMap<K,BinaryRowData>
Bucket area: pointer + hashcode.
Record area: the actual data in linked list records, a record has four parts:
BytesHashMap
are influenced by Apache Spark BytesToBytesMap.
BytesMap.LookupInfo<K,V>
Modifier and Type | Field and Description |
---|---|
protected PagedTypeSerializer<K> |
keySerializer
Used to serialize map key into RecordArea's MemorySegments.
|
BUCKET_SIZE, BUCKET_SIZE_BITS, bucketSegments, ELEMENT_POINT_LENGTH, END_OF_LIST, growthThreshold, INIT_BUCKET_MEMORY_IN_BYTES, lastBucketPosition, LOAD_FACTOR, log2NumBuckets, memoryPool, numBucketsMask, numBucketsMask2, numBucketsPerSegment, numBucketsPerSegmentBits, numBucketsPerSegmentMask, numElements, numSpillFiles, RECORD_EXTRA_LENGTH, recordArea, reservedNumBuffers, reusedKey, reusedValue, segmentSize, spillInBytes, STEP_INCREMENT
Constructor and Description |
---|
AbstractBytesHashMap(Object owner,
MemoryManager memoryManager,
long memorySize,
PagedTypeSerializer<K> keySerializer,
int valueArity) |
AbstractBytesHashMap(Object owner,
MemoryManager memoryManager,
long memorySize,
PagedTypeSerializer<K> keySerializer,
LogicalType[] valueTypes) |
Modifier and Type | Method and Description |
---|---|
BinaryRowData |
append(BytesMap.LookupInfo<K,BinaryRowData> lookupInfo,
BinaryRowData value)
Append an value into the hash map's record area.
|
void |
free()
release the map's record and bucket area's memory segments.
|
void |
free(boolean reservedRecordMemory) |
List<MemorySegment> |
getBucketAreaMemorySegments() |
KeyValueIterator<K,BinaryRowData> |
getEntryIterator(boolean requiresCopy)
Returns an iterator for iterating over the entries of this map.
|
long |
getNumElements() |
long |
getNumKeys()
Returns the number of keys in this map.
|
long |
getNumSpillFiles() |
ArrayList<MemorySegment> |
getRecordAreaMemorySegments() |
long |
getSpillInBytes() |
long |
getUsedMemoryInBytes() |
void |
reset()
reset the map's record and bucket area's memory segments for reusing.
|
calcSecondHashCode, growAndRehash, initBucketSegments, lookup, resetBucketSegments, returnSegments
protected final PagedTypeSerializer<K> keySerializer
public AbstractBytesHashMap(Object owner, MemoryManager memoryManager, long memorySize, PagedTypeSerializer<K> keySerializer, LogicalType[] valueTypes)
public AbstractBytesHashMap(Object owner, MemoryManager memoryManager, long memorySize, PagedTypeSerializer<K> keySerializer, int valueArity)
public long getNumKeys()
BytesMap
getNumKeys
in class BytesMap<K,BinaryRowData>
public BinaryRowData append(BytesMap.LookupInfo<K,BinaryRowData> lookupInfo, BinaryRowData value) throws IOException
EOFException
- if the map can't allocate much more memory.IOException
public long getNumSpillFiles()
getNumSpillFiles
in class BytesMap<K,BinaryRowData>
public long getUsedMemoryInBytes()
public long getSpillInBytes()
getSpillInBytes
in class BytesMap<K,BinaryRowData>
public long getNumElements()
getNumElements
in class BytesMap<K,BinaryRowData>
public KeyValueIterator<K,BinaryRowData> getEntryIterator(boolean requiresCopy)
public ArrayList<MemorySegment> getRecordAreaMemorySegments()
public List<MemorySegment> getBucketAreaMemorySegments()
public void free()
public void free(boolean reservedRecordMemory)
free
in class BytesMap<K,BinaryRowData>
reservedRecordMemory
- reserved fixed memory or not.public void reset()
reset
in class BytesMap<K,BinaryRowData>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.