public abstract class AbstractBufferHashGrouper<KeyType> extends Object implements Grouper<KeyType>
Grouper.BufferComparator, Grouper.Entry<T>, Grouper.KeySerde<T>, Grouper.KeySerdeFactory<T>
Modifier and Type | Field and Description |
---|---|
protected int[] |
aggregatorOffsets |
protected BufferAggregator[] |
aggregators |
protected int |
bucketSize |
protected int |
bufferGrouperMaxSize |
protected com.google.common.base.Supplier<ByteBuffer> |
bufferSupplier |
protected static int |
HASH_SIZE |
protected ByteBufferHashTable |
hashTable |
protected ByteBuffer |
hashTableBuffer |
protected int |
initialBuckets |
protected Grouper.KeySerde<KeyType> |
keySerde |
protected int |
keySize |
protected static Logger |
log |
protected float |
maxLoadFactor |
Constructor and Description |
---|
AbstractBufferHashGrouper(com.google.common.base.Supplier<ByteBuffer> bufferSupplier,
Grouper.KeySerde<KeyType> keySerde,
AggregatorFactory[] aggregatorFactories,
int bufferGrouperMaxSize) |
Modifier and Type | Method and Description |
---|---|
abstract void |
afterAggregateHook(int bucketOffset)
Called after a row is aggregated.
|
AggregateResult |
aggregate(KeyType key,
int keyHash)
Aggregate the current row with the provided key.
|
protected Grouper.Entry<KeyType> |
bucketEntryForOffset(int bucketOffset) |
abstract boolean |
canSkipAggregate(boolean bucketWasUsed,
int bucketOffset)
Called to check if it's possible to skip aggregation for a row.
|
void |
close()
Close the grouper and release associated resources.
|
int |
getBuckets() |
int |
getGrowthCount() |
int |
getMaxSize() |
int |
getSize() |
abstract void |
newBucketHook(int bucketOffset)
Called when a new bucket is used for an entry in the hash table.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aggregate, hashFunction, init, isInitialized, iterator, reset
protected static final int HASH_SIZE
protected static final Logger log
protected final com.google.common.base.Supplier<ByteBuffer> bufferSupplier
protected final Grouper.KeySerde<KeyType> keySerde
protected final int keySize
protected final BufferAggregator[] aggregators
protected final int[] aggregatorOffsets
protected final int bufferGrouperMaxSize
protected float maxLoadFactor
protected int initialBuckets
protected int bucketSize
protected ByteBufferHashTable hashTable
protected ByteBuffer hashTableBuffer
public AbstractBufferHashGrouper(com.google.common.base.Supplier<ByteBuffer> bufferSupplier, Grouper.KeySerde<KeyType> keySerde, AggregatorFactory[] aggregatorFactories, int bufferGrouperMaxSize)
public abstract void newBucketHook(int bucketOffset)
bucketOffset
- offset of the new bucket, within the buffer returned by hashTable.getTableBuffer()public abstract boolean canSkipAggregate(boolean bucketWasUsed, int bucketOffset)
bucketWasUsed
- Was the row a new entry in the hash table?bucketOffset
- Offset of the bucket containing this row's entry in the hash table,
within the buffer returned by hashTable.getTableBuffer()public abstract void afterAggregateHook(int bucketOffset)
bucketOffset
- Offset of the bucket containing the row that was aggregated,
within the buffer returned by hashTable.getTableBuffer()public int getGrowthCount()
public int getSize()
public int getBuckets()
public int getMaxSize()
public AggregateResult aggregate(KeyType key, int keyHash)
Grouper
aggregate
in interface Grouper<KeyType>
key
- key objectkeyHash
- result of Grouper.hashFunction()
on the keypublic void close()
Grouper
protected Grouper.Entry<KeyType> bucketEntryForOffset(int bucketOffset)
Copyright © 2011–2018. All rights reserved.