Interface VectorGrouper
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
BufferArrayGrouper
,HashVectorGrouper
public interface VectorGrouper extends Closeable
Like aGrouper
, but vectorized. Keys are always memory regions, so there is no generic type parameter KeyType.This interface is designed such that an implementation can implement both Grouper and VectorGrouper. Of course, it would generally only make sense for a particular instance to be called with one set of functionality or the other.
-
-
Method Summary
All Methods Instance Methods Abstract 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.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.
-
-
-
Method Detail
-
initVectorized
void initVectorized(int maxVectorSize)
Initialize the grouper. This method needs to be called before callingaggregateVector(org.apache.datasketches.memory.Memory, int, int)
.
-
aggregateVector
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.- 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
void reset()
Reset the grouper to its initial state.
-
close
void close()
Close the grouper and release associated resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
iterator
CloseableIterator<Grouper.Entry<MemoryPointer>> iterator()
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
close()
(if you are done with the VectorGrouper) orreset()
(if you want to reuse it).Callers must process and discard the returned
Grouper.Entry
s immediately, because objects may be reused.- Returns:
- entry iterator
-
-