Class RollingFormulaDefinitions

java.lang.Object
io.deephaven.engine.table.impl.updateby.RollingFormulaDefinitions

public final class RollingFormulaDefinitions extends Object
The formulas that rolling formula operators compile, and the column definitions they compile them against.

Callers that validate a rolling formula before passing it to the engine use these methods to inspect exactly the columns that the engine compiles.

  • Field Details

    • PARAM_COLUMN_NAME

      public static final String PARAM_COLUMN_NAME
      The name of the single input column of a rolling formula with a param token. The param token in the formula is replaced with this name.
      See Also:
  • Method Details

    • paramFormulaInputs

      @NotNull public static @NotNull MatchPair[] paramFormulaInputs(@NotNull @NotNull TableDefinition tableDef, @NotNull @NotNull RollingFormulaSpec spec, @NotNull @NotNull MatchPair[] columns, @NotNull @NotNull MatchPair[] groupByColumns)
      Select the input columns of a rolling formula with a param token. When columns is empty, every source column that is not a group-by column is an input. The timestamp column of a time-based window is never an input.
      Parameters:
      tableDef - the definition of the source table
      spec - the rolling formula spec
      columns - the output/input pairs of the operation, possibly empty
      groupByColumns - the group-by columns of the update by
      Returns:
      the output/input pairs for which the engine creates an operator
    • replaceParamToken

      @NotNull public static @NotNull String replaceParamToken(@NotNull @NotNull String formula, @NotNull @NotNull String paramToken)
      Replace each occurrence of paramToken in formula with PARAM_COLUMN_NAME.
      Parameters:
      formula - the formula
      paramToken - the param token
      Returns:
      the formula that the engine compiles
    • makeParamFormulaColumn

      @NotNull public static @NotNull FormulaColumn makeParamFormulaColumn(@NotNull @NotNull String outputColumnName, @NotNull @NotNull String formula, @NotNull @NotNull String paramToken)
      Make the formula column for a rolling formula with a param token, whose formula is replaceParamToken(String, String). The result is not initialized; the engine initializes it against paramFormulaInputDefinitions(Class).
      Parameters:
      outputColumnName - the name of the output column
      formula - the formula
      paramToken - the param token
      Returns:
      an uninitialized formula column
    • paramFormulaInputDefinitions

      @NotNull public static @NotNull Map<String,ColumnDefinition<?>> paramFormulaInputDefinitions(@NotNull @NotNull Class<?> inputColumnType)
      The column definitions that a rolling formula with a param token is compiled against: only PARAM_COLUMN_NAME, as a vector of the input column's type.
      Parameters:
      inputColumnType - the data type of the input column
      Returns:
      a map from PARAM_COLUMN_NAME to its vector column definition
    • makeMultiColumnFormulaColumn

      @NotNull public static @NotNull SelectColumn makeMultiColumnFormulaColumn(@NotNull @NotNull String formula)
      Make the select column for a rolling formula without a param token. The result is not initialized; the engine initializes it against multiColumnFormulaInputDefinitions(TableDefinition, Set).
      Parameters:
      formula - the formula, an assignment to the output column
      Returns:
      an uninitialized select column
    • multiColumnFormulaInputDefinitions

      @NotNull public static @NotNull Map<String,ColumnDefinition<?>> multiColumnFormulaInputDefinitions(@NotNull @NotNull TableDefinition tableDef, @NotNull @NotNull Set<String> groupByColumnNames)
      The column definitions that a rolling formula without a param token is compiled against: each group-by column as its own scalar definition, and every other source column as a vector of its type.
      Parameters:
      tableDef - the definition of the source table
      groupByColumnNames - the names of the group-by columns
      Returns:
      a map from column name to definition, in the order of tableDef