public class BytesHashMap<K> extends BytesMap<K,BinaryRow>
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 |
---|
BytesHashMap(MemorySegmentPool memoryPool,
PagedTypeSerializer<K> keySerializer,
int valueArity) |
Modifier and Type | Method and Description |
---|---|
BinaryRow |
append(BytesMap.LookupInfo<K,BinaryRow> lookupInfo,
BinaryRow value)
Append an value into the hash map's record area.
|
void |
free() |
List<MemorySegment> |
getBucketAreaMemorySegments() |
KeyValueIterator<K,BinaryRow> |
getEntryIterator(boolean requiresCopy)
Returns an iterator for iterating over the entries of this map.
|
int |
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 BytesHashMap(MemorySegmentPool memoryPool, PagedTypeSerializer<K> keySerializer, int valueArity)
public long getNumKeys()
BytesMap
getNumKeys
in class BytesMap<K,BinaryRow>
public BinaryRow append(BytesMap.LookupInfo<K,BinaryRow> lookupInfo, BinaryRow value) throws IOException
EOFException
- if the map can't allocate much more memory.IOException
public long getNumSpillFiles()
getNumSpillFiles
in class BytesMap<K,BinaryRow>
public long getUsedMemoryInBytes()
public long getSpillInBytes()
getSpillInBytes
in class BytesMap<K,BinaryRow>
public int getNumElements()
getNumElements
in class BytesMap<K,BinaryRow>
public KeyValueIterator<K,BinaryRow> getEntryIterator(boolean requiresCopy)
public ArrayList<MemorySegment> getRecordAreaMemorySegments()
public List<MemorySegment> getBucketAreaMemorySegments()
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.