Class SqlImplementor.Context

Direct Known Subclasses:
SqlImplementor.BaseContext, SqlImplementor.SimpleContext
Enclosing class:

public abstract static class SqlImplementor.Context extends Object
Context for translating a RexNode expression (within a RelNode) into a SqlNode expression (within a SQL parse tree).
  • Constructor Details

    • Context

      protected Context(SqlDialect dialect, int fieldCount)
    • Context

      protected Context(SqlDialect dialect, int fieldCount, boolean ignoreCast)
  • Method Details

    • field

      public abstract SqlNode field(int ordinal)
    • orderField

      public SqlNode orderField(int ordinal)
      Creates a reference to a field to be used in an ORDER BY clause.

      By default, it returns the same result as field(int).

      If the field has an alias, uses the alias. If the field is an unqualified column reference which is the same an alias, switches to a qualified column reference.

    • toSql

      public SqlNode toSql(@Nullable RexProgram program, RexNode rex)
      Converts an expression from RexNode to SqlNode format.
      program - Required only if rex contains RexLocalRef
      rex - Expression to convert
    • reverseCall

      protected RexCall reverseCall(RexCall call)
      Reverses the order of a call, while preserving semantics, if it improves readability.

      In the base implementation, this method does nothing; in a join context, reverses a call such as "e.deptno = d.deptno" to "d.deptno = e.deptno" if "d" is the left input to the join and "e" is the right.

    • toSql

      public SqlNode toSql(RexWindowBound rexWindowBound)
      Converts an expression from RexWindowBound to SqlNode format.
      rexWindowBound - Expression to convert
    • toSql

      public List<SqlNode> toSql(Window.Group group,<RexLiteral> constants, int inputFieldCount)
    • getAliasContext

      protected SqlImplementor.Context getAliasContext(RexCorrelVariable variable)
    • fieldList

      public List<SqlNode> fieldList()
    • toSql

      public SqlNode toSql(AggregateCall aggCall)
      Converts a call to an aggregate function to an expression.
    • toSql

      public SqlNode toSql(RelFieldCollation collation)
      Converts a collation to an ORDER BY item.
    • implementor

      public abstract SqlImplementor implementor()