Class SqlBinaryOperator
- Direct Known Subclasses:
SqlFilterOperator
,SqlInOperator
,SqlMonotonicBinaryOperator
,SqlMultisetMemberOfOperator
,SqlMultisetSetOperator
,SqlOverlapsOperator
,SqlOverOperator
,SqlPosixRegexOperator
,SqlSetOperator
,SqlWithinDistinctOperator
,SqlWithinGroupOperator
SqlBinaryOperator
is a binary operator.-
Field Summary
Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL
-
Constructor Summary
ConstructorDescriptionSqlBinaryOperator
(String name, SqlKind kind, int prec, boolean leftAssoc, @Nullable SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker) Creates a SqlBinaryOperator. -
Method Summary
Modifier and TypeMethodDescriptionprotected RelDataType
adjustType
(SqlValidator validator, SqlCall call, RelDataType type) Validates and determines coercibility and resulting collation name of binary operator if needed.deriveType
(SqlValidator validator, SqlValidatorScope scope, SqlCall call) Derives the type of a call to this operator.Returns whether a call to this operator is monotonic.@Nullable String
getSignatureTemplate
(int operandsCount) Returns a template describing how the operator signature is to be built.Returns the syntactic type of this operator, never null.@Nullable SqlOperator
reverse()
Returns the operator that has the same effect as this operator if its arguments are reversed.boolean
validRexOperands
(int count, Litmus litmus) Returns whether the given operands are valid.Methods inherited from class org.apache.calcite.sql.SqlOperator
acceptCall, acceptCall, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getNameAsId, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, rewriteCall, rightPrec, toString, unparse, unparseListClause, unparseListClause, validateCall, validateOperands
-
Constructor Details
-
SqlBinaryOperator
public SqlBinaryOperator(String name, SqlKind kind, int prec, boolean leftAssoc, @Nullable SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker) Creates a SqlBinaryOperator.- Parameters:
name
- Name of operatorkind
- Kindprec
- PrecedenceleftAssoc
- Left-associativityreturnTypeInference
- Strategy to infer return typeoperandTypeInference
- Strategy to infer operand typesoperandTypeChecker
- Validator for operand types
-
-
Method Details
-
getSyntax
Description copied from class:SqlOperator
Returns the syntactic type of this operator, never null.- Specified by:
getSyntax
in classSqlOperator
-
getSignatureTemplate
Description copied from class:SqlOperator
Returns a template describing how the operator signature is to be built. E.g for the binary + operator the template looks like "{1} {0} {2}" {0} is the operator, subsequent numbers are operands.- Overrides:
getSignatureTemplate
in classSqlOperator
- Parameters:
operandsCount
- is used with functions that can take a variable number of operands- Returns:
- signature template, or null to indicate that a default template will suffice
-
reverse
Description copied from class:SqlOperator
Returns the operator that has the same effect as this operator if its arguments are reversed.For example,
SqlStdOperatorTable.GREATER_THAN.reverse()
returnsSqlStdOperatorTable.LESS_THAN
, and vice versa, becausea > b
is equivalent tob < a
.SqlStdOperatorTable.EQUALS.reverse()
returns itself.By default, returns
null
, which means there is no inverse operator.- Overrides:
reverse
in classSqlOperator
- See Also:
-
adjustType
Description copied from class:SqlOperator
Validates and determines coercibility and resulting collation name of binary operator if needed.- Overrides:
adjustType
in classSqlOperator
-
deriveType
Description copied from class:SqlOperator
Derives the type of a call to this operator.This method is an intrinsic part of the validation process so, unlike
SqlOperator.inferReturnType(org.apache.calcite.sql.SqlOperatorBinding)
, specific operators would not typically override this method.- Overrides:
deriveType
in classSqlOperator
- Parameters:
validator
- Validatorscope
- Scope of validationcall
- Call to this operator- Returns:
- Type of call
-
getMonotonicity
Description copied from class:SqlOperator
Returns whether a call to this operator is monotonic.Default implementation returns
SqlMonotonicity.NOT_MONOTONIC
.- Overrides:
getMonotonicity
in classSqlOperator
- Parameters:
call
- Call to this operator with particular arguments and information about the monotonicity of the arguments
-
validRexOperands
Description copied from class:SqlOperator
Returns whether the given operands are valid. If not valid andfail
, throws an assertion error.Similar to
SqlOperator.checkOperandCount(org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.type.SqlOperandTypeChecker, org.apache.calcite.sql.SqlCall)
, but some operators may have different valid operands inSqlNode
andRexNode
formats (some examples are CAST and AND), and this method throws internal errors, not user errors.- Overrides:
validRexOperands
in classSqlOperator
-