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 ofVectorGrouper
backed by a growableMemoryOpenHashTable
. Growability is implemented in this class becauseMemoryOpenHashTable
is 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 AggregateResult
aggregateVector(org.apache.datasketches.memory.Memory keySpace, int startRow, int endRow)
Aggregate the current vector of rows from "startRow" to "endRow" using the provided keys.void
close()
Close the grouper and release associated resources.int
getTableStart()
void
initVectorized(int maxVectorSize)
Initialize the grouper.CloseableIterator<Grouper.Entry<MemoryPointer>>
iterator()
Iterate through entry buckets.void
reset()
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:VectorGrouper
Initialize the grouper. This method needs to be called before callingVectorGrouper.aggregateVector(org.apache.datasketches.memory.Memory, int, int)
.- Specified by:
initVectorized
in interfaceVectorGrouper
-
aggregateVector
public AggregateResult aggregateVector(org.apache.datasketches.memory.Memory keySpace, int startRow, int endRow)
Description copied from interface:VectorGrouper
Aggregate the current vector of rows from "startRow" to "endRow" using the provided keys.- Specified by:
aggregateVector
in 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:VectorGrouper
Reset the grouper to its initial state.- Specified by:
reset
in interfaceVectorGrouper
-
iterator
public CloseableIterator<Grouper.Entry<MemoryPointer>> iterator()
Description copied from interface:VectorGrouper
Iterate through entry buckets. Each bucket's key is aMemoryPointer
object 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.Entry
s immediately, because objects may be reused.- Specified by:
iterator
in interfaceVectorGrouper
- Returns:
- entry iterator
-
close
public void close()
Description copied from interface:VectorGrouper
Close the grouper and release associated resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceVectorGrouper
-
getTableStart
public int getTableStart()
-
-