Interface IncrementalOperatorAggregationStateManager
- All Known Implementing Classes:
IncrementalChunkedOperatorAggregationStateManagerOpenAddressedBase
public interface IncrementalOperatorAggregationStateManager
Interface for ChunkedOperatorAggregationHelper to process incremental updates.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(SafeCloseable bc, RowSequence rowSequence, ColumnSource<?>[] sources, MutableInt nextOutputPosition, WritableIntChunk<RowKeys> outputPositions) voidbeginUpdateCycle(long step) Allow our managers to do a little bit of work at the very start of the update cycle.voidfindModifications(SafeCloseable pc, RowSequence rowSequence, ColumnSource<?>[] sources, WritableIntChunk<RowKeys> outputPositions) intfindPositionForKey(Object key) Implement a lookup in order to supportAggregationRowLookup.get(Object).voidfindPositionsForKeys(@NotNull Chunk<? extends Values>[] keyChunks, @NotNull WritableLongChunk<RowKeys> positions) Implement a chunked lookup in order to supportAggregationRowLookup.get(Chunk[], WritableLongChunk).longThe step of the last update cycle thatbeganchanging the hash table, set before its first change.makeAggregationStateBuildContext(ColumnSource<?>[] buildSources, long maxSize) makeProbeContext(ColumnSource<?>[] probeSources, long maxSize) intvoidremove(SafeCloseable pc, RowSequence rowSequence, ColumnSource<?>[] sources, WritableIntChunk<RowKeys> outputPositions) void
-
Field Details
-
UNKNOWN_ROW
static final int UNKNOWN_ROW- See Also:
-
-
Method Details
-
makeProbeContext
-
beginUpdateCycle
void beginUpdateCycle(long step) Allow our managers to do a little bit of work at the very start of the update cycle. We have this method so that even if nothing is to be done, we rehash a little bit on each cycle to avoid always rehashing when there is other work to be done. Called before any change to the hash table in the cycle.- Parameters:
step- the clock step of the update cycle
-
lastStateChangeStep
long lastStateChangeStep()The step of the last update cycle thatbeganchanging the hash table, set before its first change. A cycle that has rehash work left, adds rows or modifies keys may change the hash table, so it records its step; a cycle that only removes rows or modifies other columns leaves the hash table unchanged, and records nothing. A reader on another thread reads the clock's step before its reads, and this after them behind afence. Compared to the reader's step, this is:- less: no cycle at or after the reader's step changed the hash table during the reads, so they saw its state at that step, which is both its previous and current state;
- equal: the reader's step's cycle has begun changing the hash table, so the reads may not have seen its previous state; they saw its current state if the reader waited for that cycle to finish;
- greater: a later cycle has begun changing the hash table, so the reads may not have seen either state at the reader's step.
- Returns:
- the step of the last update cycle that began changing the hash table, or
QueryConstants.NULL_LONGif none has
-
startTrackingPrevValues
void startTrackingPrevValues() -
remove
void remove(SafeCloseable pc, RowSequence rowSequence, ColumnSource<?>[] sources, WritableIntChunk<RowKeys> outputPositions) -
findModifications
void findModifications(SafeCloseable pc, RowSequence rowSequence, ColumnSource<?>[] sources, WritableIntChunk<RowKeys> outputPositions) -
maxTableSize
int maxTableSize() -
makeAggregationStateBuildContext
-
add
void add(SafeCloseable bc, RowSequence rowSequence, ColumnSource<?>[] sources, MutableInt nextOutputPosition, WritableIntChunk<RowKeys> outputPositions) -
getKeyHashTableSources
ColumnSource[] getKeyHashTableSources() -
findPositionForKey
Implement a lookup in order to supportAggregationRowLookup.get(Object).- Parameters:
key- The opaque group-by key to find the row position/key for- Returns:
- The row position/key for
keyin the result table, or -1 if not found
-
findPositionsForKeys
void findPositionsForKeys(@NotNull @NotNull Chunk<? extends Values>[] keyChunks, @NotNull @NotNull WritableLongChunk<RowKeys> positions) Implement a chunked lookup in order to supportAggregationRowLookup.get(Chunk[], WritableLongChunk).- Parameters:
keyChunks- The group-by keys, one chunk per group-by column, at least one, reinterpreted as for the buildpositions- Receives the row position/key of each key, or -1 for a key not found; its size is set to the number of keys
-