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
,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)
for windowed operatorsfinishUpdate(UpdateByOperator.Context)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A context item for use with updateBy operators -
Field Summary
Modifier and TypeFieldDescriptionprotected final String[]
protected final long
protected ModifiedColumnSet
The input modifiedColumnSet for this operatorprotected final boolean
protected ModifiedColumnSet
The output modifiedColumnSet for this operatorprotected final MatchPair
protected final long
protected RowRedirection
protected final String
-
Constructor Summary
ModifierConstructorDescriptionprotected
UpdateByOperator
(@NotNull MatchPair pair, @NotNull String[] affectingColumns, @Nullable String timestampColumnName, long reverseWindowScaleUnits, long forwardWindowScaleUnits, boolean isWindowed) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
applyOutputShift
(@NotNull RowSet subRowSetToShift, long delta) Apply a shift to the operation.protected abstract void
clearOutputRows
(RowSet toClear) Clear the output rows by setting value to NULL.abstract UpdateByOperator
copy()
Create an uninitialized copy of this operator.protected void
createInputModifiedColumnSet
(@NotNull QueryTable source) Create the modified column set for the input columns of this operator.protected void
createOutputModifiedColumnSet
(@NotNull QueryTable result) Create the modified column set for the output columns from this operator.protected void
extractDownstreamModifiedColumnSet
(@NotNull TableUpdate upstream, @NotNull TableUpdate downstream) Set the downstream modified column set appropriately for this operator.protected void
finishUpdate
(@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 long
Get 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 ModifiedColumnSet
Return 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 outputColumnSource
for this operation.protected ModifiedColumnSet
Return the modified column set for the output columns from this operator.protected long
Get the value of the backward-looking window (might be nanoseconds or ticks).protected @Nullable String
Get the name of the timestamp column for this operator (or null if the operator does not require timestamp data).void
initializeCumulative
(@NotNull UpdateByOperator.Context context, long firstUnmodifiedKey, long firstUnmodifiedTimestamp, @NotNull RowSet bucketRowSet) Initialize the bucket context for a cumulative operatorvoid
initializeRolling
(@NotNull UpdateByOperator.Context context, @NotNull RowSet bucketRowSet) Initialize the bucket context for a windowed operatorabstract void
initializeSources
(@NotNull Table source, @Nullable RowRedirection rowRedirection) Initialize this operator with a specific source table (and row redirection if needed).abstract @NotNull UpdateByOperator.Context
makeUpdateContext
(int affectedChunkSize, int influencerChunkSize) Make anUpdateByOperator.Context
suitable for use with updates.protected abstract void
prepareForParallelPopulation
(RowSet changedRows) Prepare this operator output column for parallel updated.protected boolean
Return whether the operator needs affected and influencer row positions during accumulation.protected abstract void
Indicate 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. -
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 -
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 outputColumnSource
for 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.Context
suitable 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
.
-