Interface InitializerExpressionFactory

All Known Implementing Classes:
CountingFactory, NullInitializerExpressionFactory, VirtualColumnsExpressionFactory

public interface InitializerExpressionFactory
InitializerExpressionFactory supplies default values for INSERT, UPDATE, and NEW.
  • Method Details

    • isGeneratedAlways

      @Deprecated boolean isGeneratedAlways(RelOptTable table, int iColumn)
      Deprecated.
      Use c.generationStrategy(t, i) == VIRTUAL || c.generationStrategy(t, i) == STORED
      Whether a column is always generated. If a column is always generated, then non-generated values cannot be inserted into the column.
      See Also:
    • generationStrategy

      ColumnStrategy generationStrategy(RelOptTable table, int iColumn)
      Returns how a column is populated.
      Parameters:
      table - the table containing the column
      iColumn - the 0-based offset of the column in the table
      Returns:
      generation strategy, never null
      See Also:
    • newColumnDefaultValue

      RexNode newColumnDefaultValue(RelOptTable table, int iColumn, InitializerContext context)
      Creates an expression which evaluates to the default value for a particular column.

      If the default value comes from a un-validated SqlNode, make sure to invoke InitializerContext.validateExpression(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.sql.SqlNode) first before you actually do the conversion with method InitializerContext.convertExpression(org.apache.calcite.sql.SqlNode).

      Parameters:
      table - the table containing the column
      iColumn - the 0-based offset of the column in the table
      context - Context for creating the expression
      Returns:
      default value expression
    • postExpressionConversionHook

      @Nullable BiFunction<InitializerContext,RelNode,RelNode> postExpressionConversionHook()
      Creates a hook function to customize the relational expression right after the column expressions are converted. Usually the relational expression is a projection above a table scan.
      Returns:
      a hook function to transform the relational expression right after the column expression conversion to a customized one
      See Also:
    • newAttributeInitializer

      RexNode newAttributeInitializer(RelDataType type, SqlFunction constructor, int iAttribute, List<RexNode> constructorArgs, InitializerContext context)
      Creates an expression which evaluates to the initializer expression for a particular attribute of a structured type.
      Parameters:
      type - the structured type
      constructor - the constructor invoked to initialize the type
      iAttribute - the 0-based offset of the attribute in the type
      constructorArgs - arguments passed to the constructor invocation
      context - Context for creating the expression
      Returns:
      default value expression