Class HashVectorGrouper
java.lang.Object
org.apache.druid.query.groupby.epinephelinae.HashVectorGrouper
- All Implemented Interfaces:
Closeable,AutoCloseable,VectorGrouper
An implementation of
VectorGrouper backed by a growable MemoryOpenHashTable. Growability is
implemented in this class because MemoryOpenHashTable is not innately growable.-
Constructor Summary
ConstructorsConstructorDescriptionHashVectorGrouper(com.google.common.base.Supplier<ByteBuffer> bufferSupplier, int keySize, AggregatorAdapters aggregators, int bufferGrouperMaxSize, float maxLoadFactor, int configuredInitialNumBuckets) -
Method Summary
Modifier and TypeMethodDescriptionaggregateVector(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.intvoidinitVectorized(int maxVectorSize) Initialize the grouper.iterator()Iterate through entry buckets.voidreset()Reset the grouper to its initial state.
-
Constructor Details
-
HashVectorGrouper
public HashVectorGrouper(com.google.common.base.Supplier<ByteBuffer> bufferSupplier, int keySize, AggregatorAdapters aggregators, int bufferGrouperMaxSize, float maxLoadFactor, int configuredInitialNumBuckets)
-
-
Method Details
-
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
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()
-