Class SqlWindowTableFunction

All Implemented Interfaces:
SqlTableFunction
Direct Known Subclasses:
SqlHopTableFunction, SqlSessionTableFunction, SqlTumbleTableFunction

public class SqlWindowTableFunction extends SqlFunction implements SqlTableFunction
Base class for a table-valued function that computes windows. Examples include TUMBLE, HOP and SESSION.
  • Field Details

    • PARAM_DATA

      protected static final String PARAM_DATA
      The data source which the table function computes with.
      See Also:
    • PARAM_TIMECOL

      protected static final String PARAM_TIMECOL
      The time attribute column. Also known as the event time.
      See Also:
    • PARAM_SIZE

      protected static final String PARAM_SIZE
      The window duration INTERVAL.
      See Also:
    • PARAM_OFFSET

      protected static final String PARAM_OFFSET
      The optional align offset for each window.
      See Also:
    • PARAM_KEY

      protected static final String PARAM_KEY
      The session key(s), only used for SESSION window.
      See Also:
    • PARAM_SLIDE

      protected static final String PARAM_SLIDE
      The slide interval, only used for HOP window.
      See Also:
    • ARG0_TABLE_FUNCTION_WINDOWING

      public static final SqlReturnTypeInference ARG0_TABLE_FUNCTION_WINDOWING
      Type-inference strategy whereby the row type of a table function call is a ROW, which is combined from the row type of operand #0 (which is a TABLE) and two additional fields. The fields are as follows:
      1. window_start: TIMESTAMP type to indicate a window's start
      2. window_end: TIMESTAMP type to indicate a window's end
  • Constructor Details

    • SqlWindowTableFunction

      public SqlWindowTableFunction(String name, SqlOperandMetadata operandMetadata)
      Creates a window table function with a given name.
  • Method Details

    • getOperandTypeChecker

      public @Nullable SqlOperandMetadata getOperandTypeChecker()
      Overrides:
      getOperandTypeChecker in class SqlOperator
    • getRowTypeInference

      public SqlReturnTypeInference getRowTypeInference()
      Description copied from interface: SqlTableFunction
      Returns the record type of the table yielded by this function when applied to given arguments. Only literal arguments are passed, non-literal are replaced with default values (null, 0, false, etc).
      Specified by:
      getRowTypeInference in interface SqlTableFunction
      Returns:
      strategy to infer the row type of a call to this function
    • argumentMustBeScalar

      public boolean argumentMustBeScalar(int ordinal)
      Returns whether the ordinalth argument to this operator must be scalar (as opposed to a query).

      If true (the default), the validator will attempt to convert the argument into a scalar sub-query, which must have one column and return at most one row.

      Operators such as SELECT and EXISTS override this method.

      Overrides because the first parameter of table-value function windowing is an explicit TABLE parameter, which is not scalar.

      Overrides:
      argumentMustBeScalar in class SqlOperator