Class RexCallBinding

java.lang.Object
org.apache.calcite.sql.SqlOperatorBinding
org.apache.calcite.rex.RexCallBinding

public class RexCallBinding extends SqlOperatorBinding
RexCallBinding implements SqlOperatorBinding by referring to an underlying collection of RexNode operands.
  • Constructor Details

  • Method Details

    • create

      public static RexCallBinding create(RelDataTypeFactory typeFactory, RexCall call, List<RelCollation> inputCollations)
      Creates a binding of the appropriate type.
    • create

      public static RexCallBinding create(RelDataTypeFactory typeFactory, RexCall call, @Nullable RexProgram program, List<RelCollation> inputCollations)
      Creates a binding of the appropriate type, optionally with a program.
    • getStringLiteralOperand

      public @Nullable String getStringLiteralOperand(int ordinal)
      Description copied from class: SqlOperatorBinding
      Gets the string value of a string literal operand.
      Overrides:
      getStringLiteralOperand in class SqlOperatorBinding
      Parameters:
      ordinal - zero-based ordinal of operand of interest
      Returns:
      string value
    • getIntLiteralOperand

      public int getIntLiteralOperand(int ordinal)
      Description copied from class: SqlOperatorBinding
      Gets the integer value of a numeric literal operand.
      Overrides:
      getIntLiteralOperand in class SqlOperatorBinding
      Parameters:
      ordinal - zero-based ordinal of operand of interest
      Returns:
      integer value
    • getOperandLiteralValue

      public <T> @Nullable T getOperandLiteralValue(int ordinal, Class<T> clazz)
      Description copied from class: SqlOperatorBinding
      Gets the value of a literal operand.

      Cases:

      • If the operand is not a literal, the value is null.
      • If the operand is a string literal, the value will be of type NlsString.
      • If the operand is a numeric literal, the value will be of type BigDecimal.
      • If the operand is an interval qualifier, the value will be of type SqlIntervalQualifier
      • Otherwise the type is undefined, and the value may be null.
      Overrides:
      getOperandLiteralValue in class SqlOperatorBinding
      Parameters:
      ordinal - zero-based ordinal of operand of interest
      clazz - Desired valued type
      Returns:
      value of operand
    • getOperandMonotonicity

      public SqlMonotonicity getOperandMonotonicity(int ordinal)
      Description copied from class: SqlOperatorBinding
      Gets the monotonicity of a bound operand.
      Overrides:
      getOperandMonotonicity in class SqlOperatorBinding
      Parameters:
      ordinal - zero-based ordinal of operand of interest
      Returns:
      monotonicity of operand
    • isOperandNull

      public boolean isOperandNull(int ordinal, boolean allowCast)
      Description copied from class: SqlOperatorBinding
      Determines whether a bound operand is NULL.

      This is only relevant for SQL validation.

      Overrides:
      isOperandNull in class SqlOperatorBinding
      Parameters:
      ordinal - zero-based ordinal of operand of interest
      allowCast - whether to regard CAST(constant) as a constant
      Returns:
      whether operand is null; false for everything except SQL validation
    • isOperandLiteral

      public boolean isOperandLiteral(int ordinal, boolean allowCast)
      Description copied from class: SqlOperatorBinding
      Determines whether an operand is a literal.
      Overrides:
      isOperandLiteral in class SqlOperatorBinding
      Parameters:
      ordinal - zero-based ordinal of operand of interest
      allowCast - whether to regard CAST(literal) as a literal
      Returns:
      whether operand is literal
    • operands

      public List<RexNode> operands()
    • getOperandCount

      public int getOperandCount()
      Description copied from class: SqlOperatorBinding
      Returns the number of bound operands. Includes pre-operands and regular operands.
      Specified by:
      getOperandCount in class SqlOperatorBinding
    • getOperandType

      public RelDataType getOperandType(int ordinal)
      Description copied from class: SqlOperatorBinding
      Gets the type of a bound operand.
      Specified by:
      getOperandType in class SqlOperatorBinding
      Parameters:
      ordinal - zero-based ordinal of operand of interest
      Returns:
      bound operand type
    • newError

      public CalciteException newError(org.apache.calcite.runtime.Resources.ExInst<SqlValidatorException> e)
      Description copied from class: SqlOperatorBinding
      Wraps a validation error with context appropriate to this operator call.
      Specified by:
      newError in class SqlOperatorBinding
      Parameters:
      e - Validation error, not null
      Returns:
      Error wrapped, if possible, with positional information