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 AggregatorAdapters |
aggregators |
protected int |
baseAggregatorOffset |
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,
AggregatorAdapters aggregators,
int baseAggregatorOffset,
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(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, waitaggregate, hashFunction, init, isInitialized, iterator, resetprotected 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 AggregatorAdapters aggregators
protected final int baseAggregatorOffset
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, AggregatorAdapters aggregators, int baseAggregatorOffset, 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(int bucketOffset)
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)
Grouperaggregate in interface Grouper<KeyType>key - key objectkeyHash - result of Grouper.hashFunction() on the keypublic void close()
Grouperprotected Grouper.Entry<KeyType> bucketEntryForOffset(int bucketOffset)
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.