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.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.
|
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)
HashTable
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
.public void updateInitialCapacity(int initialCapacity)
HashTable
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.updateInitialCapacity
in interface HashTable
initialCapacity
- The new initial capacity to use.public void updateBatches() throws SchemaChangeException
HashTable
HashTableTemplate.BatchHolder
s.
This is useful on OK_NEW_SCHEMA (need to verify).updateBatches
in interface HashTable
SchemaChangeException
public int numBuckets()
public int numResizing()
public void getStats(HashTableStats stats)
public void clear()
HashTable
HashTable
.public int getBuildHashCode(int incomingRowIdx) throws SchemaChangeException
getBuildHashCode
in interface HashTable
incomingRowIdx
- SchemaChangeException
public int getProbeHashCode(int incomingRowIdx) throws SchemaChangeException
getProbeHashCode
in interface HashTable
incomingRowIdx
- SchemaChangeException
public HashTable.PutStatus put(int incomingRowIdx, IndexPointer htIdxHolder, int hashCode, int targetBatchRowCount) throws SchemaChangeException, RetryAfterSpillException
put
in interface HashTable
incomingRowIdx
- - 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()SchemaChangeException
RetryAfterSpillException
public int probeForKey(int incomingRowIdx, int hashCode) throws SchemaChangeException
probeForKey
in interface HashTable
incomingRowIdx
- hashCode
- - The hash code for the Probe-side keySchemaChangeException
protected 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)
HashTable
HashTableTemplate.BatchHolder
s.updateIncoming
in interface HashTable
newIncoming
- The new build side batch.newIncomingProbe
- The new probe side batch.public boolean outputKeys(int batchIdx, VectorContainer outContainer, int numRecords)
HashTable
HashTable
.outputKeys
in interface 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.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
SchemaChangeException
protected abstract int getHashBuild(@Named(value="incomingRowIdx") int incomingRowIdx, @Named(value="seedValue") int seedValue) throws SchemaChangeException
SchemaChangeException
protected abstract int getHashProbe(@Named(value="incomingRowIdx") int incomingRowIdx, @Named(value="seedValue") int seedValue) throws SchemaChangeException
SchemaChangeException
public long getActualSize()
HashTable
getActualSize
in interface HashTable
public String makeDebugString()
HashTable
makeDebugString
in interface HashTable
public void setTargetBatchRowCount(int batchRowCount)
setTargetBatchRowCount
in interface HashTable
public int getTargetBatchRowCount()
getTargetBatchRowCount
in interface HashTable
Copyright © 1970 The Apache Software Foundation. All rights reserved.