Class BaseBlinkFirstOrLastChunkedOperator
java.lang.Object
io.deephaven.engine.table.impl.by.BaseBlinkFirstOrLastChunkedOperator
- All Implemented Interfaces:
IterativeChunkedAggregationOperator
- Direct Known Subclasses:
BlinkFirstChunkedOperator,CopyingPermutedBlinkFirstOrLastChunkedOperator
public abstract class BaseBlinkFirstOrLastChunkedOperator
extends Object
implements IterativeChunkedAggregationOperator
Base class with shared boilerplate for
BlinkFirstChunkedOperator and BlinkLastChunkedOperator.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.by.IterativeChunkedAggregationOperator
IterativeChunkedAggregationOperator.BucketedContext, IterativeChunkedAggregationOperator.SingletonContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected final ChunkSource.WithPrev<?>[]Input columns, parallel tooutputColumnsandresultColumns.protected final intThe number of result columns.protected final WritableColumnSource<?>[]Output columns, parallel toinputColumnsandresultColumns.protected LongArraySourceMap from destination slot to first key.Fields inherited from interface io.deephaven.engine.table.impl.by.IterativeChunkedAggregationOperator
ZERO_LENGTH_ITERATIVE_CHUNKED_AGGREGATION_OPERATOR_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseBlinkFirstOrLastChunkedOperator(@NotNull MatchPair[] resultPairs, @NotNull Table blinkTable) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfinal Map<String,? extends ColumnSource<?>> Return a map of result columns produced by this operator.final voidmodifyChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Values> previousValues, Chunk<? extends Values> newValues, LongChunk<? extends RowKeys> postShiftRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Modify a chunk of data previously aggregated into the result columns using a parallel chunk of new values.final booleanmodifyChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Values> previousValues, Chunk<? extends Values> newValues, LongChunk<? extends RowKeys> postShiftRowKeys, long destination) Modify a chunk of data previously aggregated into the result columns using a parallel chunk of new values.final voidmodifyRowKeys(IterativeChunkedAggregationOperator.BucketedContext context, LongChunk<? extends RowKeys> inputRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Called with the modified row keys whenIterativeChunkedAggregationOperator.requiresRowKeys()returns true if our input columns have not changed (or we have none).final booleanmodifyRowKeys(IterativeChunkedAggregationOperator.SingletonContext context, LongChunk<? extends RowKeys> rowKeys, long destination) Called with the modified row keys whenIterativeChunkedAggregationOperator.requiresRowKeys()returns true if our input columns have not changed (or we have none).final voidremoveChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Values> values, LongChunk<? extends RowKeys> inputRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Remove a chunk of data previously aggregated into the result columns.final booleanremoveChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Values> values, LongChunk<? extends RowKeys> inputRowKeys, long destination) Remove a chunk of data previously aggregated into the result columns.final booleanWhether the operator requires row keys.voidresetForStep(@NotNull TableUpdate upstream, int startingDestinationsCount) Reset any per-step internal state.final voidshiftChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Values> previousValues, Chunk<? extends Values> newValues, LongChunk<? extends RowKeys> preShiftRowKeys, LongChunk<? extends RowKeys> postShiftRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Called with shifted row keys whenIterativeChunkedAggregationOperator.requiresRowKeys()returns true, including shifted same-slot modifies.final booleanshiftChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, Chunk<? extends Values> previousValues, Chunk<? extends Values> newValues, LongChunk<? extends RowKeys> preShiftRowKeys, LongChunk<? extends RowKeys> postShiftRowKeys, long destination) Shift a chunk of data previously aggregated into the result columns, including shifted same-slot modifies.final voidstartRecording(LongConsumer reincarnatedDestinationCallback, LongConsumer emptiedDestinationCallback) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.engine.table.impl.by.IterativeChunkedAggregationOperator
addChunk, addChunk, addRowSet, ensureCapacity, initializeRefreshing, makeBucketedContext, makeSingletonContext, propagateFailure, propagateInitialState, propagateUpdates, requiresRunFinds, startTrackingPrevValues, unchunkedRowSet
-
Field Details
-
COPY_CHUNK_SIZE
protected static final int COPY_CHUNK_SIZE- See Also:
-
numResultColumns
protected final int numResultColumnsThe number of result columns. This is the size ofresultColumnsand the length ofinputColumnsandoutputColumns. -
inputColumns
Input columns, parallel to
outputColumnsandresultColumns.These are the source columns from the upstream table, reinterpreted to primitives where applicable.
-
outputColumns
Output columns, parallel to
inputColumnsandresultColumns.These are the result columns, reinterpreted to primitives where applicable.
-
redirections
Map from destination slot to first key. Only used during a step to keep track of the appropriate rows to copy into the output columns.
-
-
Constructor Details
-
BaseBlinkFirstOrLastChunkedOperator
-
-
Method Details
-
getResultColumns
Description copied from interface:IterativeChunkedAggregationOperatorReturn a map of result columns produced by this operator.- Specified by:
getResultColumnsin interfaceIterativeChunkedAggregationOperator- Returns:
- a map of name to columns for the result table
-
requiresRowKeys
public final boolean requiresRowKeys()Description copied from interface:IterativeChunkedAggregationOperatorWhether the operator requires row keys. This implies that the operator must process shifts (i.e.IterativeChunkedAggregationOperator.shiftChunk(io.deephaven.engine.table.impl.by.IterativeChunkedAggregationOperator.BucketedContext, io.deephaven.chunk.Chunk<? extends io.deephaven.chunk.attributes.Values>, io.deephaven.chunk.Chunk<? extends io.deephaven.chunk.attributes.Values>, io.deephaven.chunk.LongChunk<? extends io.deephaven.engine.rowset.chunkattributes.RowKeys>, io.deephaven.chunk.LongChunk<? extends io.deephaven.engine.rowset.chunkattributes.RowKeys>, io.deephaven.chunk.IntChunk<io.deephaven.engine.rowset.chunkattributes.RowKeys>, io.deephaven.chunk.IntChunk<io.deephaven.chunk.attributes.ChunkPositions>, io.deephaven.chunk.IntChunk<io.deephaven.chunk.attributes.ChunkLengths>, io.deephaven.chunk.WritableBooleanChunk<io.deephaven.chunk.attributes.Values>)), and must observe modifications even when its input columns (if any) are not modified (i.e.IterativeChunkedAggregationOperator.modifyRowKeys(io.deephaven.engine.table.impl.by.IterativeChunkedAggregationOperator.BucketedContext, io.deephaven.chunk.LongChunk<? extends io.deephaven.engine.rowset.chunkattributes.RowKeys>, io.deephaven.chunk.IntChunk<io.deephaven.engine.rowset.chunkattributes.RowKeys>, io.deephaven.chunk.IntChunk<io.deephaven.chunk.attributes.ChunkPositions>, io.deephaven.chunk.IntChunk<io.deephaven.chunk.attributes.ChunkLengths>, io.deephaven.chunk.WritableBooleanChunk<io.deephaven.chunk.attributes.Values>)).- Specified by:
requiresRowKeysin interfaceIterativeChunkedAggregationOperator- Returns:
- true if the operator requires row keys, false otherwise
-
resetForStep
@OverridingMethodsMustInvokeSuper public void resetForStep(@NotNull @NotNull TableUpdate upstream, int startingDestinationsCount) Description copied from interface:IterativeChunkedAggregationOperatorReset any per-step internal state. Note that the arguments to this method should not be mutated in any way.- Specified by:
resetForStepin interfaceIterativeChunkedAggregationOperator- Parameters:
upstream- The upstream ShiftAwareListener.UpdatestartingDestinationsCount- The number of used destinations at the beginning of this step
-
removeChunk
public final void removeChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Values> values, LongChunk<? extends RowKeys> inputRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Description copied from interface:IterativeChunkedAggregationOperatorRemove a chunk of data previously aggregated into the result columns.- Specified by:
removeChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
bucketedContext- the operator-specific contextvalues- a chunk of values that have been previously aggregated.inputRowKeys- the input row keys, in pre-shift spacedestinations- the destinations in resultColumn to remove the values from, parallel with startPositions and lengthstartPositions- the starting positions in the chunk for each destinationlength- the number of values in the chunk for each destinationstateModified- a boolean output array, parallel to destinations, which is set to true if the corresponding destination has been modified
-
modifyChunk
public final void modifyChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Values> previousValues, Chunk<? extends Values> newValues, LongChunk<? extends RowKeys> postShiftRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Description copied from interface:IterativeChunkedAggregationOperatorModify a chunk of data previously aggregated into the result columns using a parallel chunk of new values. Never includes modifies that have been shifted ifIterativeChunkedAggregationOperator.requiresRowKeys()returns true - those are handled inIterativeChunkedAggregationOperator.shiftChunk(BucketedContext, Chunk, Chunk, LongChunk, LongChunk, IntChunk, IntChunk, IntChunk, WritableBooleanChunk).- Specified by:
modifyChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
bucketedContext- the operator-specific contextpreviousValues- a chunk of values that have been previously aggregatednewValues- a chunk of values to aggregatepostShiftRowKeys- the input row keys, in post-shift spacedestinations- the destinations in resultColumn to remove the values from, parallel with startPositions and lengthstartPositions- the starting positions in the chunk for each destinationlength- the number of values in the chunk for each destinationstateModified- a boolean output array, parallel to destinations, which is set to true if the corresponding destination has been modified
-
shiftChunk
public final void shiftChunk(IterativeChunkedAggregationOperator.BucketedContext bucketedContext, Chunk<? extends Values> previousValues, Chunk<? extends Values> newValues, LongChunk<? extends RowKeys> preShiftRowKeys, LongChunk<? extends RowKeys> postShiftRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Description copied from interface:IterativeChunkedAggregationOperatorCalled with shifted row keys whenIterativeChunkedAggregationOperator.requiresRowKeys()returns true, including shifted same-slot modifies.- Specified by:
shiftChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
bucketedContext- the operator-specific contextpreviousValues- a chunk of values that have been previously aggregated.newValues- a chunk of values to aggregatepreShiftRowKeys- the input row keys, in pre-shift spacepostShiftRowKeys- the input row keys, in post-shift spacedestinations- the destinations in resultColumn to aggregate into, parallel with startPositions and lengthstartPositions- the starting positions in the chunk for each destinationlength- the number of values in the chunk for each destinationstateModified- a boolean output array, parallel to destinations, which is set to true if the corresponding destination has been modified
-
modifyRowKeys
public final void modifyRowKeys(IterativeChunkedAggregationOperator.BucketedContext context, LongChunk<? extends RowKeys> inputRowKeys, IntChunk<RowKeys> destinations, IntChunk<ChunkPositions> startPositions, IntChunk<ChunkLengths> length, WritableBooleanChunk<Values> stateModified) Description copied from interface:IterativeChunkedAggregationOperatorCalled with the modified row keys whenIterativeChunkedAggregationOperator.requiresRowKeys()returns true if our input columns have not changed (or we have none).- Specified by:
modifyRowKeysin interfaceIterativeChunkedAggregationOperator- Parameters:
context- the operator-specific contextinputRowKeys- the input row keys, in post-shift spacedestinations- the destinations in resultColumn to aggregate into, parallel with startPositions and lengthstartPositions- the starting positions in the chunk for each destinationlength- the number of values in the chunk for each destinationstateModified- a boolean output array, parallel to destinations, which is set to true if the corresponding destination has been modified
-
removeChunk
public final boolean removeChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Values> values, LongChunk<? extends RowKeys> inputRowKeys, long destination) Description copied from interface:IterativeChunkedAggregationOperatorRemove a chunk of data previously aggregated into the result columns.- Specified by:
removeChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
singletonContext- the operator-specific contextchunkSize- the size of the removalvalues- the values to remove from the aggregationinputRowKeys- the input row keys, in pre-shift spacedestination- the destination in the result columns- Returns:
- true if the state was modified, false otherwise
-
modifyChunk
public final boolean modifyChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, int chunkSize, Chunk<? extends Values> previousValues, Chunk<? extends Values> newValues, LongChunk<? extends RowKeys> postShiftRowKeys, long destination) Description copied from interface:IterativeChunkedAggregationOperatorModify a chunk of data previously aggregated into the result columns using a parallel chunk of new values. Never includes modifies that have been shifted ifIterativeChunkedAggregationOperator.requiresRowKeys()returns true - those are handled inIterativeChunkedAggregationOperator.shiftChunk(SingletonContext, Chunk, Chunk, LongChunk, LongChunk, long).- Specified by:
modifyChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
singletonContext- the operator-specific contextchunkSize- the size of the modificationpreviousValues- a chunk of values that have been previously aggregated.newValues- a chunk of values to aggregatepostShiftRowKeys- the input row keys, in post-shift space- Returns:
- true if the state was modified, false otherwise
-
shiftChunk
public final boolean shiftChunk(IterativeChunkedAggregationOperator.SingletonContext singletonContext, Chunk<? extends Values> previousValues, Chunk<? extends Values> newValues, LongChunk<? extends RowKeys> preShiftRowKeys, LongChunk<? extends RowKeys> postShiftRowKeys, long destination) Description copied from interface:IterativeChunkedAggregationOperatorShift a chunk of data previously aggregated into the result columns, including shifted same-slot modifies.- Specified by:
shiftChunkin interfaceIterativeChunkedAggregationOperator- Parameters:
singletonContext- the operator-specific contextpreviousValues- a chunk of values that have been previously aggregated.newValues- a chunk of values to aggregatepreShiftRowKeys- the input row keys, in pre-shift spacepostShiftRowKeys- the input row keys, in post-shift spacedestination- the destination in the result columns- Returns:
- true if the result should be considered modified
-
modifyRowKeys
public final boolean modifyRowKeys(IterativeChunkedAggregationOperator.SingletonContext context, LongChunk<? extends RowKeys> rowKeys, long destination) Description copied from interface:IterativeChunkedAggregationOperatorCalled with the modified row keys whenIterativeChunkedAggregationOperator.requiresRowKeys()returns true if our input columns have not changed (or we have none).- Specified by:
modifyRowKeysin interfaceIterativeChunkedAggregationOperator- Parameters:
context- the operator-specific contextrowKeys- the modified row keys for a given destination, in post-shift spacedestination- the destination that was modified- Returns:
- true if the result should be considered modified
-
startRecording
public final void startRecording(LongConsumer reincarnatedDestinationCallback, LongConsumer emptiedDestinationCallback) -
finishRecording
public final void finishRecording()
-