public interface HashTable
Modifier and Type | Interface and Description |
---|---|
static class |
HashTable.PutStatus |
Modifier and Type | Field and Description |
---|---|
static int |
BATCH_MASK |
static int |
BATCH_SIZE
The batch size used for internal batch holders
|
static float |
DEFAULT_LOAD_FACTOR
The default load factor of a hash table.
|
static int |
MAXIMUM_CAPACITY
The maximum capacity of the hash table (in terms of number of buckets).
|
static TemplateClassDefinition<HashTable> |
TEMPLATE_DEFINITION |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Frees all the direct memory consumed by the
HashTable . |
long |
getActualSize()
The amount of direct memory consumed by the hash table.
|
int |
getBuildHashCode(int incomingRowIdx)
Computes the hash code for the record at the given index in the build side batch.
|
int |
getProbeHashCode(int incomingRowIdx)
Computes the hash code for the record at the given index in the probe side batch.
|
void |
getStats(HashTableStats stats) |
int |
getTargetBatchRowCount() |
boolean |
isEmpty() |
String |
makeDebugString()
Returns a message containing memory usage statistics.
|
boolean |
outputKeys(int batchIdx,
VectorContainer outContainer,
int numRecords)
Retrieves the key columns and transfers them to the output container.
|
int |
probeForKey(int incomingRowIdx,
int hashCode) |
HashTable.PutStatus |
put(int incomingRowIdx,
IndexPointer htIdxHolder,
int hashCode,
int batchSize) |
void |
reset()
Clears all the memory used by the
HashTable and re-initializes it. |
void |
setTargetBatchRowCount(int batchRowCount) |
void |
setup(HashTableConfig htConfig,
BufferAllocator allocator,
VectorContainer incomingBuild,
RecordBatch incomingProbe,
RecordBatch outgoing,
VectorContainer htContainerOrig)
setup(HashTableConfig, BufferAllocator, VectorContainer, RecordBatch, RecordBatch, VectorContainer) must be called before anything can be done to the
HashTable . |
int |
size() |
void |
updateBatches()
Updates the incoming (build and probe side) value vectors references in the
HashTableTemplate.BatchHolder s. |
void |
updateIncoming(VectorContainer newIncoming,
RecordBatch newIncomingProbe)
Changes the incoming probe and build side batches, and then updates all the value vector references in the
HashTableTemplate.BatchHolder s. |
void |
updateInitialCapacity(int initialCapacity)
Update the initial capacity for the hash table.
|
static final TemplateClassDefinition<HashTable> TEMPLATE_DEFINITION
static final int MAXIMUM_CAPACITY
static final float DEFAULT_LOAD_FACTOR
static final int BATCH_SIZE
static final int BATCH_MASK
void setup(HashTableConfig htConfig, BufferAllocator allocator, VectorContainer incomingBuild, RecordBatch incomingProbe, RecordBatch outgoing, VectorContainer htContainerOrig)
setup(HashTableConfig, BufferAllocator, VectorContainer, RecordBatch, RecordBatch, VectorContainer)
must be called before anything can be done to the
HashTable
.htConfig
- allocator
- incomingBuild
- incomingProbe
- outgoing
- htContainerOrig
- void updateBatches() throws SchemaChangeException
HashTableTemplate.BatchHolder
s.
This is useful on OK_NEW_SCHEMA (need to verify).SchemaChangeException
int getBuildHashCode(int incomingRowIdx) throws SchemaChangeException
incomingRowIdx
- The index of the build side record of interest.SchemaChangeException
int getProbeHashCode(int incomingRowIdx) throws SchemaChangeException
incomingRowIdx
- The index of the probe side record of interest.SchemaChangeException
HashTable.PutStatus put(int incomingRowIdx, IndexPointer htIdxHolder, int hashCode, int batchSize) throws SchemaChangeException, RetryAfterSpillException
int probeForKey(int incomingRowIdx, int hashCode) throws SchemaChangeException
incomingRowIdx
- The index of the key in the probe batch.hashCode
- The hashCode of the key.SchemaChangeException
void getStats(HashTableStats stats)
int size()
boolean isEmpty()
void clear()
HashTable
.void updateInitialCapacity(int initialCapacity)
HashTableTemplate.BatchHolder
s of appropriate size when the final size of the HashTable is known.
Warning! Only call this method before you have inserted elements into the HashTable.initialCapacity
- The new initial capacity to use.void updateIncoming(VectorContainer newIncoming, RecordBatch newIncomingProbe)
HashTableTemplate.BatchHolder
s.newIncoming
- The new build side batch.newIncomingProbe
- The new probe side batch.void reset()
HashTable
and re-initializes it.boolean outputKeys(int batchIdx, VectorContainer outContainer, int numRecords)
HashTable
.batchIdx
- The index of a HashTableTemplate.BatchHolder
in the HashTable.outContainer
- The destination container for the key columns.numRecords
- The number of key recorts to transfer.String makeDebugString()
long getActualSize()
void setTargetBatchRowCount(int batchRowCount)
int getTargetBatchRowCount()
Copyright © 2018 The Apache Software Foundation. All rights reserved.