Package io.trino.operator
Class GroupedTopNRowNumberAccumulator
- java.lang.Object
-
- io.trino.operator.GroupedTopNRowNumberAccumulator
-
public class GroupedTopNRowNumberAccumulator extends Object
Memory Layout:+--------------------+ +--------------+ |GroupIdToHeapBuffer | |HeapNodeBuffer| +--------------------+ +--------------+ Group1+->+RootNodeIndex1+-------->+RowID1 | |RootNodeIndex2 | |LeftChild1+-----+ |... | |RightChild1 | | +--------------------+ |RowID2 <-----+ |HeapSize1 | |LeftChild2 | |HeapSize2 | |RightChild2 | |... | |... | +--------------------+ +--------------+
-
-
Constructor Summary
Constructors Constructor Description GroupedTopNRowNumberAccumulator(RowIdComparisonStrategy strategy, int topN, LongConsumer rowIdEvictionListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(long groupId, RowReference rowReference)Add the specified row to this accumulator.longdrainTo(long groupId, LongBigArray rowIdOutput)Drain the contents of groupId from this accumulator to the provided output row ID buffer.longsizeOf()
-
-
-
Constructor Detail
-
GroupedTopNRowNumberAccumulator
public GroupedTopNRowNumberAccumulator(RowIdComparisonStrategy strategy, int topN, LongConsumer rowIdEvictionListener)
-
-
Method Detail
-
sizeOf
public long sizeOf()
-
add
public boolean add(long groupId, RowReference rowReference)Add the specified row to this accumulator.This may trigger row eviction callbacks if other rows have to be evicted to make space.
- Returns:
- true if this row was incorporated, false otherwise
-
drainTo
public long drainTo(long groupId, LongBigArray rowIdOutput)Drain the contents of groupId from this accumulator to the provided output row ID buffer.Rows will be presented in increasing rank order. Draining will not trigger any row eviction callbacks. After this method completion, the Accumulator will contain zero rows for the specified groupId.
- Returns:
- number of rows deposited to the output buffer
-
-