| Modifier and Type | Class and Description |
|---|---|
class |
HashTableTemplate.BatchHolder |
HashTable.PutStatus| Modifier and Type | Field and Description |
|---|---|
protected ClassGenerator<?> |
cg |
protected FragmentContext |
context |
static int |
MAX_VARCHAR_SIZE |
BATCH_MASK, BATCH_SIZE, DEFAULT_LOAD_FACTOR, MAXIMUM_CAPACITY, TEMPLATE_DEFINITION| Constructor and Description |
|---|
HashTableTemplate() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Frees all the direct memory consumed by the
HashTable. |
protected abstract void |
doSetup(VectorContainer incomingBuild,
RecordBatch incomingProbe) |
void |
enlargeEmptyHashTableIfNeeded(int newNum)
Resize up the Hash Table if needed (to hold newNum entries)
|
long |
getActualSize()
The amount of direct memory consumed by the hash table.
|
int |
getBuildHashCode(int incomingRowIdx)
Return the Hash Value for the row in the Build incoming batch at index:
(For Hash Aggregate there's no "Build" side -- only one batch - this one)
|
protected abstract int |
getHashBuild(int incomingRowIdx,
int seedValue) |
protected abstract int |
getHashProbe(int incomingRowIdx,
int seedValue) |
int |
getProbeHashCode(int incomingRowIdx)
Return the Hash Value for the row in the Probe incoming batch at index:
|
void |
getStats(HashTableStats stats) |
int |
getTargetBatchRowCount() |
protected HashTableTemplate.BatchHolder |
injectMembers(HashTableTemplate.BatchHolder batchHolder) |
boolean |
isEmpty() |
String |
makeDebugString()
Returns a message containing memory usage statistics.
|
protected HashTableTemplate.BatchHolder |
newBatchHolder(int index,
int newBatchHolderSize) |
org.apache.commons.lang3.tuple.Pair<VectorContainer,Integer> |
nextBatch() |
int |
numBuckets() |
int |
numResizing() |
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)
Return -1 if Probe-side key is not found in the (build-side) hash table.
|
HashTable.PutStatus |
put(int incomingRowIdx,
IndexPointer htIdxHolder,
int hashCode,
int targetBatchRowCount)
put() uses the hash code (from gethashCode() above) to insert the key(s) from the incoming
row into the hash table.
|
void |
reset()
Reinit the hash table to its original size, and clear up all its prior batch holder
|
void |
setTargetBatchRowCount(int batchRowCount) |
void |
setup(HashTableConfig htConfig,
BufferAllocator allocator,
VectorContainer incomingBuild,
RecordBatch incomingProbe,
RecordBatch outgoing,
VectorContainer htContainerOrig,
FragmentContext context,
ClassGenerator<?> cg)
HashTable.setup(org.apache.drill.exec.physical.impl.common.HashTableConfig, org.apache.drill.exec.memory.BufferAllocator, org.apache.drill.exec.record.VectorContainer, org.apache.drill.exec.record.RecordBatch, org.apache.drill.exec.record.RecordBatch, org.apache.drill.exec.record.VectorContainer, org.apache.drill.exec.ops.FragmentContext, org.apache.drill.exec.expr.ClassGenerator<?>) 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.BatchHolders. |
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.BatchHolders. |
void |
updateInitialCapacity(int initialCapacity)
Update the initial capacity for the hash table.
|
public static final int MAX_VARCHAR_SIZE
protected FragmentContext context
protected ClassGenerator<?> cg
public void setup(HashTableConfig htConfig, BufferAllocator allocator, VectorContainer incomingBuild, RecordBatch incomingProbe, RecordBatch outgoing, VectorContainer htContainerOrig, FragmentContext context, ClassGenerator<?> cg)
HashTableHashTable.setup(org.apache.drill.exec.physical.impl.common.HashTableConfig, org.apache.drill.exec.memory.BufferAllocator, org.apache.drill.exec.record.VectorContainer, org.apache.drill.exec.record.RecordBatch, org.apache.drill.exec.record.RecordBatch, org.apache.drill.exec.record.VectorContainer, org.apache.drill.exec.ops.FragmentContext, org.apache.drill.exec.expr.ClassGenerator<?>) must be called before anything can be done to the HashTable.public void updateInitialCapacity(int initialCapacity)
HashTableHashTableTemplate.BatchHolders 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.updateInitialCapacity in interface HashTableinitialCapacity - The new initial capacity to use.public void updateBatches()
throws SchemaChangeException
HashTableHashTableTemplate.BatchHolders.
This is useful on OK_NEW_SCHEMA (need to verify).updateBatches in interface HashTableSchemaChangeExceptionpublic int numBuckets()
public int numResizing()
public void getStats(HashTableStats stats)
public void clear()
HashTableHashTable.public int getBuildHashCode(int incomingRowIdx)
throws SchemaChangeException
getBuildHashCode in interface HashTableincomingRowIdx - SchemaChangeExceptionpublic int getProbeHashCode(int incomingRowIdx)
throws SchemaChangeException
getProbeHashCode in interface HashTableincomingRowIdx - SchemaChangeExceptionpublic HashTable.PutStatus put(int incomingRowIdx, IndexPointer htIdxHolder, int hashCode, int targetBatchRowCount) throws SchemaChangeException, RetryAfterSpillException
put in interface HashTableincomingRowIdx - - position of the incoming rowhtIdxHolder - - to return batch + batch-offset (for caller to manage a matching batch)hashCode - - computed over the key(s) by calling getBuildHashCode()SchemaChangeExceptionRetryAfterSpillExceptionpublic int probeForKey(int incomingRowIdx,
int hashCode)
throws SchemaChangeException
probeForKey in interface HashTableincomingRowIdx - hashCode - - The hash code for the Probe-side keySchemaChangeExceptionprotected HashTableTemplate.BatchHolder newBatchHolder(int index, int newBatchHolderSize)
protected HashTableTemplate.BatchHolder injectMembers(HashTableTemplate.BatchHolder batchHolder)
public void enlargeEmptyHashTableIfNeeded(int newNum)
public void reset()
public void updateIncoming(VectorContainer newIncoming, RecordBatch newIncomingProbe)
HashTableHashTableTemplate.BatchHolders.updateIncoming in interface HashTablenewIncoming - The new build side batch.newIncomingProbe - The new probe side batch.public boolean outputKeys(int batchIdx,
VectorContainer outContainer,
int numRecords)
HashTableHashTable.outputKeys in interface HashTablebatchIdx - 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.public org.apache.commons.lang3.tuple.Pair<VectorContainer,Integer> nextBatch()
protected abstract void doSetup(@Named(value="incomingBuild")
VectorContainer incomingBuild,
@Named(value="incomingProbe")
RecordBatch incomingProbe)
throws SchemaChangeException
SchemaChangeExceptionprotected abstract int getHashBuild(@Named(value="incomingRowIdx")
int incomingRowIdx,
@Named(value="seedValue")
int seedValue)
throws SchemaChangeException
SchemaChangeExceptionprotected abstract int getHashProbe(@Named(value="incomingRowIdx")
int incomingRowIdx,
@Named(value="seedValue")
int seedValue)
throws SchemaChangeException
SchemaChangeExceptionpublic long getActualSize()
HashTablegetActualSize in interface HashTablepublic String makeDebugString()
HashTablemakeDebugString in interface HashTablepublic void setTargetBatchRowCount(int batchRowCount)
setTargetBatchRowCount in interface HashTablepublic int getTargetBatchRowCount()
getTargetBatchRowCount in interface HashTableCopyright © 2022 The Apache Software Foundation. All rights reserved.