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

public abstract class UpdateByOperator extends Object
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.
  1. initializeCumulative(Context, long, long, RowSet) for cumulative operators or initializeRolling(Context, RowSet) (Context)} for windowed operators
  2. UpdateByOperator.Context.accumulateCumulative(RowSequence, Chunk[], LongChunk, int) for cumulative operators or UpdateByOperator.Context.accumulateRolling(RowSequence, Chunk[], LongChunk, LongChunk, IntChunk, IntChunk, int) for windowed operators
  3. finishUpdate(UpdateByOperator.Context)
  • Field Details

    • pair

      protected final MatchPair pair
    • affectingColumns

      protected final String[] affectingColumns
    • reverseWindowScaleUnits

      protected final long reverseWindowScaleUnits
    • forwardWindowScaleUnits

      protected final long forwardWindowScaleUnits
    • timestampColumnName

      protected final String timestampColumnName
    • isWindowed

      protected final boolean isWindowed
    • rowRedirection

      protected RowRedirection rowRedirection
    • inputModifiedColumnSet

      protected ModifiedColumnSet inputModifiedColumnSet
      The input modifiedColumnSet for this operator
    • outputModifiedColumnSet

      protected ModifiedColumnSet outputModifiedColumnSet
      The output modifiedColumnSet for this operator
  • Constructor Details

    • UpdateByOperator

      protected UpdateByOperator(@NotNull @NotNull MatchPair pair, @NotNull @NotNull String[] affectingColumns, @Nullable @Nullable String timestampColumnName, long reverseWindowScaleUnits, long forwardWindowScaleUnits, boolean isWindowed)
  • Method Details

    • copy

      public abstract UpdateByOperator 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

      @NotNull protected @NotNull String[] getInputColumnNames()
      Get the names of the input column(s) for this operator.
      Returns:
      the names of the input column
    • getTimestampColumnName

      @Nullable protected @Nullable String 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

      @NotNull protected @NotNull String[] 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

      @NotNull protected @NotNull String[] getOutputColumnNames()
      Get an array of the output column names.
      Returns:
      the output column names.
    • getOutputColumns

      @NotNull protected abstract @NotNull Map<String,ColumnSource<?>> getOutputColumns()
      Get a map of outputName to output ColumnSource 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 an UpdateByOperator.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

      protected void finishUpdate(@NotNull @NotNull UpdateByOperator.Context context)
      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

      protected abstract void applyOutputShift(@NotNull @NotNull RowSet subRowSetToShift, long delta)
      Apply a shift to the operation.
    • prepareForParallelPopulation

      protected abstract void prepareForParallelPopulation(RowSet changedRows)
      Prepare this operator output column for parallel updated.
    • createInputModifiedColumnSet

      protected void createInputModifiedColumnSet(@NotNull @NotNull QueryTable source)
      Create the modified column set for the input columns of this operator.
    • createOutputModifiedColumnSet

      protected void createOutputModifiedColumnSet(@NotNull @NotNull QueryTable result)
      Create the modified column set for the output columns from this operator.
    • getInputModifiedColumnSet

      protected ModifiedColumnSet getInputModifiedColumnSet()
      Return the modified column set for the input columns of this operator.
    • getOutputModifiedColumnSet

      protected ModifiedColumnSet 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

      protected abstract void clearOutputRows(RowSet toClear)
      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 to false.