Class HashVectorGrouper
- java.lang.Object
-
- org.apache.druid.query.groupby.epinephelinae.HashVectorGrouper
-
- All Implemented Interfaces:
Closeable,AutoCloseable,VectorGrouper
public class HashVectorGrouper extends Object implements VectorGrouper
An implementation ofVectorGrouperbacked by a growableMemoryOpenHashTable. Growability is implemented in this class becauseMemoryOpenHashTableis not innately growable.
-
-
Constructor Summary
Constructors Constructor Description HashVectorGrouper(com.google.common.base.Supplier<ByteBuffer> bufferSupplier, int keySize, AggregatorAdapters aggregators, int bufferGrouperMaxSize, float maxLoadFactor, int configuredInitialNumBuckets)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AggregateResultaggregateVector(org.apache.datasketches.memory.Memory keySpace, int startRow, int endRow)Aggregate the current vector of rows from "startRow" to "endRow" using the provided keys.voidclose()Close the grouper and release associated resources.intgetTableStart()voidinitVectorized(int maxVectorSize)Initialize the grouper.CloseableIterator<Grouper.Entry<MemoryPointer>>iterator()Iterate through entry buckets.voidreset()Reset the grouper to its initial state.
-
-
-
Constructor Detail
-
HashVectorGrouper
public HashVectorGrouper(com.google.common.base.Supplier<ByteBuffer> bufferSupplier, int keySize, AggregatorAdapters aggregators, int bufferGrouperMaxSize, float maxLoadFactor, int configuredInitialNumBuckets)
-
-
Method Detail
-
initVectorized
public void initVectorized(int maxVectorSize)
Description copied from interface:VectorGrouperInitialize the grouper. This method needs to be called before callingVectorGrouper.aggregateVector(org.apache.datasketches.memory.Memory, int, int).- Specified by:
initVectorizedin interfaceVectorGrouper
-
aggregateVector
public AggregateResult aggregateVector(org.apache.datasketches.memory.Memory keySpace, int startRow, int endRow)
Description copied from interface:VectorGrouperAggregate the current vector of rows from "startRow" to "endRow" using the provided keys.- Specified by:
aggregateVectorin interfaceVectorGrouper- Parameters:
keySpace- array holding keys, chunked into ints. First (endRow - startRow) keys must be valid.startRow- row to start at (inclusive).endRow- row to end at (exclusive).- Returns:
- result that indicates how many keys were aggregated (may be partial due to resource limits)
-
reset
public void reset()
Description copied from interface:VectorGrouperReset the grouper to its initial state.- Specified by:
resetin interfaceVectorGrouper
-
iterator
public CloseableIterator<Grouper.Entry<MemoryPointer>> iterator()
Description copied from interface:VectorGrouperIterate through entry buckets. Each bucket's key is aMemoryPointerobject in native byte order.After you are done with the iterator returned by this method, you should either call
VectorGrouper.close()(if you are done with the VectorGrouper) orVectorGrouper.reset()(if you want to reuse it).Callers must process and discard the returned
Grouper.Entrys immediately, because objects may be reused.- Specified by:
iteratorin interfaceVectorGrouper- Returns:
- entry iterator
-
close
public void close()
Description copied from interface:VectorGrouperClose the grouper and release associated resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceVectorGrouper
-
getTableStart
public int getTableStart()
-
-