Class UpdateByOperator
java.lang.Object
io.deephaven.engine.table.impl.updateby.UpdateByOperator
- Direct Known Subclasses:
BaseByteUpdateByOperator,BaseCharUpdateByOperator,BaseDoubleUpdateByOperator,BaseFloatUpdateByOperator,BaseIntUpdateByOperator,BaseLongUpdateByOperator,BaseObjectUpdateByOperator,BaseShortUpdateByOperator,BooleanRollingFormulaOperator,ByteRollingFormulaOperator,CharRollingFormulaOperator,DoubleRollingFormulaOperator,FloatRollingFormulaOperator,IntRollingFormulaOperator,LongRollingFormulaOperator,ObjectRollingFormulaOperator,RollingFormulaMultiColumnOperator,RollingGroupOperator,ShortRollingFormulaOperator
An operator that performs a specific computation for
TableOperations.updateBy(io.deephaven.api.updateby.UpdateByOperation). When adding implementations of this
interface, the pattern of calls will be as follows.
initializeCumulative(Context, long, long, RowSet)for cumulative operators orinitializeRolling(Context, RowSet)(Context)} for windowed operatorsUpdateByOperator.Context.accumulateCumulative(RowSequence, Chunk[], LongChunk, int)for cumulative operators orUpdateByOperator.Context.accumulateRolling(RowSequence, Chunk[], LongChunk, LongChunk, IntChunk, IntChunk, int, int)for windowed operatorsfinishUpdate(UpdateByOperator.Context)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA context item for use with updateBy operators -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final String[]protected final longprotected ModifiedColumnSetThe input modifiedColumnSet for this operatorprotected final booleanprotected ModifiedColumnSetThe output modifiedColumnSet for this operatorprotected final MatchPairprotected final longprotected RowRedirectionprotected final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUpdateByOperator(@NotNull MatchPair pair, @NotNull String[] affectingColumns, @Nullable String timestampColumnName, long reverseWindowScaleUnits, long forwardWindowScaleUnits, boolean isWindowed) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidapplyOutputShift(@NotNull RowSet subRowSetToShift, long delta) Apply a shift to the operation.protected abstract voidclearOutputRows(RowSet toClear) Clear the output rows by setting value to NULL.abstract UpdateByOperatorcopy()Create an uninitialized copy of this operator.protected voidcreateInputModifiedColumnSet(@NotNull QueryTable source) Create the modified column set for the input columns of this operator.protected voidcreateOutputModifiedColumnSet(@NotNull QueryTable result) Create the modified column set for the output columns from this operator.protected voidextractDownstreamModifiedColumnSet(@NotNull TableUpdate upstream, @NotNull TableUpdate downstream) Set the downstream modified column set appropriately for this operator.protected voidfinishUpdate(@NotNull UpdateByOperator.Context context) Perform any bookkeeping required at the end of a single part of the update.protected @NotNull String[]Get an array of column names that, when modified, affect the result of this computation.protected longGet the value of the forward-looking window (might be nanoseconds or ticks).protected @NotNull String[]Get the names of the input column(s) for this operator.protected ModifiedColumnSetReturn the modified column set for the input columns of this operator.protected @NotNull String[]Get an array of the output column names.protected abstract @NotNull Map<String,ColumnSource<?>> Get a map of outputName to outputColumnSourcefor this operation.protected ModifiedColumnSetReturn the modified column set for the output columns from this operator.protected longGet the value of the backward-looking window (might be nanoseconds or ticks).protected @Nullable StringGet the name of the timestamp column for this operator (or null if the operator does not require timestamp data).voidinitializeCumulative(@NotNull UpdateByOperator.Context context, long firstUnmodifiedKey, long firstUnmodifiedTimestamp, @NotNull RowSet bucketRowSet) Initialize the bucket context for a cumulative operatorvoidinitializeCumulativeWithKeyValues(@NotNull UpdateByOperator.Context context, long firstUnmodifiedKey, long firstUnmodifiedTimestamp, @NotNull RowSet bucketRowSet, @NotNull Object[] bucketKeyValues) Initialize the bucket context for a cumulative operator and pass in the bucket key values.voidinitializeRolling(@NotNull UpdateByOperator.Context context, @NotNull RowSet bucketRowSet) Initialize the bucket context for a windowed operatorvoidinitializeRollingWithKeyValues(@NotNull UpdateByOperator.Context context, @NotNull RowSet bucketRowSet, @NotNull Object[] bucketKeyValues) Initialize the bucket context for a windowed operator and pass in the bucket key values.abstract voidinitializeSources(@NotNull Table source, @Nullable RowRedirection rowRedirection) Initialize this operator with a specific source table (and row redirection if needed).abstract @NotNull UpdateByOperator.ContextmakeUpdateContext(int affectedChunkSize, int influencerChunkSize) Make anUpdateByOperator.Contextsuitable for use with updates.protected abstract voidprepareForParallelPopulation(RowSet changedRows) Prepare this operator output column for parallel updated.protected booleanReturn whether the operator needs affected and influencer row positions during accumulation.protected abstract voidIndicate that the operation should start tracking previous values for ticking updates.
-
Field Details
-
pair
-
affectingColumns
-
reverseWindowScaleUnits
protected final long reverseWindowScaleUnits -
forwardWindowScaleUnits
protected final long forwardWindowScaleUnits -
timestampColumnName
-
isWindowed
protected final boolean isWindowed -
rowRedirection
-
inputModifiedColumnSet
The input modifiedColumnSet for this operator -
outputModifiedColumnSet
The output modifiedColumnSet for this operator
-
-
Constructor Details
-
UpdateByOperator
-
-
Method Details
-
copy
Create an uninitialized copy of this operator.initializeSources(Table, RowRedirection)must be called before this operator can be used.- Returns:
- a copy of this operator
-
initializeSources
public abstract void initializeSources(@NotNull @NotNull Table source, @Nullable @Nullable RowRedirection rowRedirection) Initialize this operator with a specific source table (and row redirection if needed). This will be called exactly once per operator. -
initializeCumulativeWithKeyValues
public void initializeCumulativeWithKeyValues(@NotNull @NotNull UpdateByOperator.Context context, long firstUnmodifiedKey, long firstUnmodifiedTimestamp, @NotNull @NotNull RowSet bucketRowSet, @NotNull @NotNull Object[] bucketKeyValues) Initialize the bucket context for a cumulative operator and pass in the bucket key values. Most operators will not need the key values, but those that do can override this method. -
initializeCumulative
public void initializeCumulative(@NotNull @NotNull UpdateByOperator.Context context, long firstUnmodifiedKey, long firstUnmodifiedTimestamp, @NotNull @NotNull RowSet bucketRowSet) Initialize the bucket context for a cumulative operator -
initializeRollingWithKeyValues
public void initializeRollingWithKeyValues(@NotNull @NotNull UpdateByOperator.Context context, @NotNull @NotNull RowSet bucketRowSet, @NotNull @NotNull Object[] bucketKeyValues) Initialize the bucket context for a windowed operator and pass in the bucket key values. Most operators will not need the key values, but those that do can override this method. -
initializeRolling
public void initializeRolling(@NotNull @NotNull UpdateByOperator.Context context, @NotNull @NotNull RowSet bucketRowSet) Initialize the bucket context for a windowed operator -
getInputColumnNames
Get the names of the input column(s) for this operator.- Returns:
- the names of the input column
-
getTimestampColumnName
Get the name of the timestamp column for this operator (or null if the operator does not require timestamp data).- Returns:
- the name of the timestamp column
-
getPrevWindowUnits
protected long getPrevWindowUnits()Get the value of the backward-looking window (might be nanoseconds or ticks). -
getFwdWindowUnits
protected long getFwdWindowUnits()Get the value of the forward-looking window (might be nanoseconds or ticks). -
getAffectingColumnNames
Get an array of column names that, when modified, affect the result of this computation.- Returns:
- an array of column names that affect this operator.
-
getOutputColumnNames
Get an array of the output column names.- Returns:
- the output column names.
-
getOutputColumns
Get a map of outputName to outputColumnSourcefor this operation.- Returns:
- a map of output column name to output column source
-
startTrackingPrev
protected abstract void startTrackingPrev()Indicate that the operation should start tracking previous values for ticking updates. -
makeUpdateContext
@NotNull public abstract @NotNull UpdateByOperator.Context makeUpdateContext(int affectedChunkSize, int influencerChunkSize) Make anUpdateByOperator.Contextsuitable for use with updates.- Parameters:
affectedChunkSize- The maximum size of affected chunks that will be provided during the update.influencerChunkSize- The maximum size of influencer chunks that will be provided during the update.- Returns:
- a new context
-
finishUpdate
Perform any bookkeeping required at the end of a single part of the update. This is always preceded with a call to#initializeUpdate(Context)(specialized for each type of operator)- Parameters:
context- the context object
-
applyOutputShift
Apply a shift to the operation. -
prepareForParallelPopulation
Prepare this operator output column for parallel updated. -
createInputModifiedColumnSet
Create the modified column set for the input columns of this operator. -
createOutputModifiedColumnSet
Create the modified column set for the output columns from this operator. -
getInputModifiedColumnSet
Return the modified column set for the input columns of this operator. -
getOutputModifiedColumnSet
Return the modified column set for the output columns from this operator. -
extractDownstreamModifiedColumnSet
protected void extractDownstreamModifiedColumnSet(@NotNull @NotNull TableUpdate upstream, @NotNull @NotNull TableUpdate downstream) Set the downstream modified column set appropriately for this operator. -
clearOutputRows
Clear the output rows by setting value to NULL. Dense sources will apply removes to the inner source. -
requiresRowPositions
protected boolean requiresRowPositions()Return whether the operator needs affected and influencer row positions during accumulation. Defaults tofalse.
-