Package org.apache.calcite.rex
Class RexCallBinding
java.lang.Object
org.apache.calcite.sql.SqlOperatorBinding
org.apache.calcite.rex.RexCallBinding
RexCallBinding implements SqlOperatorBinding by
referring to an underlying collection of RexNode operands.-
Field Summary
Fields inherited from class org.apache.calcite.sql.SqlOperatorBinding
typeFactory -
Constructor Summary
ConstructorsConstructorDescriptionRexCallBinding(RelDataTypeFactory typeFactory, SqlOperator sqlOperator, List<? extends RexNode> operands, List<RelCollation> inputCollations) -
Method Summary
Modifier and TypeMethodDescriptionstatic RexCallBindingcreate(RelDataTypeFactory typeFactory, RexCall call, List<RelCollation> inputCollations) Creates a binding of the appropriate type.static RexCallBindingcreate(RelDataTypeFactory typeFactory, RexCall call, @Nullable RexProgram program, List<RelCollation> inputCollations) Creates a binding of the appropriate type, optionally with a program.intgetIntLiteralOperand(int ordinal) Gets the integer value of a numeric literal operand.intReturns the number of bound operands.<T> @Nullable TgetOperandLiteralValue(int ordinal, Class<T> clazz) Gets the value of a literal operand.getOperandMonotonicity(int ordinal) Gets the monotonicity of a bound operand.getOperandType(int ordinal) Gets the type of a bound operand.@Nullable StringgetStringLiteralOperand(int ordinal) Gets the string value of a string literal operand.booleanisOperandLiteral(int ordinal, boolean allowCast) Determines whether an operand is a literal.booleanisOperandNull(int ordinal, boolean allowCast) Determines whether a bound operand is NULL.newError(org.apache.calcite.runtime.Resources.ExInst<SqlValidatorException> e) Wraps a validation error with context appropriate to this operator call.operands()Methods inherited from class org.apache.calcite.sql.SqlOperatorBinding
collectOperandTypes, getCollationType, getColumnListParamInfo, getCursorOperand, getGroupCount, getOperandLiteralValue, getOperandLiteralValue, getOperator, getPreOperandCount, getTypeFactory, hasFilter, isOperandTimeFrame, transform
-
Constructor Details
-
RexCallBinding
public RexCallBinding(RelDataTypeFactory typeFactory, SqlOperator sqlOperator, List<? extends RexNode> operands, List<RelCollation> inputCollations)
-
-
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
Description copied from class:SqlOperatorBindingGets the string value of a string literal operand.- Overrides:
getStringLiteralOperandin classSqlOperatorBinding- Parameters:
ordinal- zero-based ordinal of operand of interest- Returns:
- string value
-
getIntLiteralOperand
public int getIntLiteralOperand(int ordinal) Description copied from class:SqlOperatorBindingGets the integer value of a numeric literal operand.- Overrides:
getIntLiteralOperandin classSqlOperatorBinding- Parameters:
ordinal- zero-based ordinal of operand of interest- Returns:
- integer value
-
getOperandLiteralValue
Description copied from class:SqlOperatorBindingGets 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:
getOperandLiteralValuein classSqlOperatorBinding- Parameters:
ordinal- zero-based ordinal of operand of interestclazz- Desired valued type- Returns:
- value of operand
-
getOperandMonotonicity
Description copied from class:SqlOperatorBindingGets the monotonicity of a bound operand.- Overrides:
getOperandMonotonicityin classSqlOperatorBinding- 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:SqlOperatorBindingDetermines whether a bound operand is NULL.This is only relevant for SQL validation.
- Overrides:
isOperandNullin classSqlOperatorBinding- Parameters:
ordinal- zero-based ordinal of operand of interestallowCast- 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:SqlOperatorBindingDetermines whether an operand is a literal.- Overrides:
isOperandLiteralin classSqlOperatorBinding- Parameters:
ordinal- zero-based ordinal of operand of interestallowCast- whether to regard CAST(literal) as a literal- Returns:
- whether operand is literal
-
operands
-
getOperandCount
public int getOperandCount()Description copied from class:SqlOperatorBindingReturns the number of bound operands. Includes pre-operands and regular operands.- Specified by:
getOperandCountin classSqlOperatorBinding
-
getOperandType
Description copied from class:SqlOperatorBindingGets the type of a bound operand.- Specified by:
getOperandTypein classSqlOperatorBinding- 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:SqlOperatorBindingWraps a validation error with context appropriate to this operator call.- Specified by:
newErrorin classSqlOperatorBinding- Parameters:
e- Validation error, not null- Returns:
- Error wrapped, if possible, with positional information
-