public class LimitedBufferGrouper<KeyType> extends AbstractBufferGrouper<KeyType>
| Modifier and Type | Class and Description |
|---|---|
static class |
LimitedBufferGrouper.BufferGrouperOffsetHeapIndexUpdater |
Grouper.BufferComparator, Grouper.Entry<T>, Grouper.KeySerde<T>, Grouper.KeySerdeFactory<T>aggregatorOffsets, aggregators, bucketSize, bufferGrouperMaxSize, bufferSupplier, HASH_SIZE, hashTable, initialBuckets, keySerde, keySize, log, maxLoadFactor| Constructor and Description |
|---|
LimitedBufferGrouper(com.google.common.base.Supplier<ByteBuffer> bufferSupplier,
Grouper.KeySerde<KeyType> keySerde,
ColumnSelectorFactory columnSelectorFactory,
AggregatorFactory[] aggregatorFactories,
int bufferGrouperMaxSize,
float maxLoadFactor,
int initialBuckets,
int limit,
boolean sortHasNonGroupingFields) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterAggregateHook(int bucketOffset)
Called after a row is aggregated.
|
boolean |
canSkipAggregate(boolean bucketWasUsed,
int bucketOffset)
Called to check if it's possible to skip aggregation for a row.
|
int |
getLimit() |
void |
init()
Initialize the grouper.
|
boolean |
isInitialized()
Check this grouper is initialized or not.
|
Iterator<Grouper.Entry<KeyType>> |
iterator(boolean sorted)
Iterate through entries.
|
void |
newBucketHook(int bucketOffset)
Called when a new bucket is used for an entry in the hash table.
|
void |
reset()
Reset the grouper to its initial state.
|
aggregate, aggregate, bucketEntryForOffset, close, getBuckets, getGrowthCount, getMaxSize, getSizepublic LimitedBufferGrouper(com.google.common.base.Supplier<ByteBuffer> bufferSupplier, Grouper.KeySerde<KeyType> keySerde, ColumnSelectorFactory columnSelectorFactory, AggregatorFactory[] aggregatorFactories, int bufferGrouperMaxSize, float maxLoadFactor, int initialBuckets, int limit, boolean sortHasNonGroupingFields)
public void init()
GrouperGrouper.aggregate(Object) and Grouper.aggregate(Object, int).public boolean isInitialized()
Grouperpublic void newBucketHook(int bucketOffset)
AbstractBufferGroupernewBucketHook in class AbstractBufferGrouper<KeyType>bucketOffset - offset of the new bucket, within the buffer returned by hashTable.getTableBuffer()public boolean canSkipAggregate(boolean bucketWasUsed,
int bucketOffset)
AbstractBufferGroupercanSkipAggregate in class AbstractBufferGrouper<KeyType>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 void afterAggregateHook(int bucketOffset)
AbstractBufferGrouperafterAggregateHook in class AbstractBufferGrouper<KeyType>bucketOffset - Offset of the bucket containing the row that was aggregated,
within the buffer returned by hashTable.getTableBuffer()public void reset()
Grouperpublic Iterator<Grouper.Entry<KeyType>> iterator(boolean sorted)
Grouper
Once this method is called, writes are no longer safe. After you are done with the iterator returned by this
method, you should either call Grouper.close() (if you are done with the Grouper), Grouper.reset() (if you
want to reuse it), or Grouper.iterator(boolean) again if you want another iterator.
If "sorted" is true then the iterator will return sorted results. It will use KeyType's natural ordering on
deserialized objects, and will use the KeySerde#comparator() on serialized objects. Woe be unto you
if these comparators are not equivalent.
sorted - return sorted resultspublic int getLimit()
Copyright © 2011–2017. All rights reserved.