Class SqlBetweenOperator
Syntax:
X [NOT] BETWEEN [ASYMMETRIC | SYMMETRIC] Y AND
Z
If the asymmetric/symmetric keywords are left out ASYMMETRIC is default.
This operator is always expanded (into something like Y <= X AND
X <= Z
) before being converted into Rex nodes.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Defines the "SYMMETRIC" and "ASYMMETRIC" keywords.Nested classes/interfaces inherited from class org.apache.calcite.sql.SqlSpecialOperator
SqlSpecialOperator.ReduceResult, SqlSpecialOperator.TokenSequence
-
Field Summary
Modifier and TypeFieldDescriptionfinal SqlBetweenOperator.Flag
static final int
Ordinal of the 'lower' operand.static final int
Ordinal of the 'upper' operand.static final int
Ordinal of the 'value' operand.Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
getSignatureTemplate
(int operandsCount) Returns a template describing how the operator signature is to be built.inferReturnType
(SqlOperatorBinding opBinding) Infers the return type of an invocation of this operator; only called after the number and types of operands have already been validated.boolean
Returns whether this is 'NOT' variant of an operator.not()
Returns the operator that is the logical inverse of this operator.reduceExpr
(int opOrdinal, SqlSpecialOperator.TokenSequence list) Reduces a list of operators and arguments according to the rules of precedence and associativity.void
Writes a SQL representation of a call to this operator to a writer, including parentheses if the operators on either side are of greater precedence.boolean
validRexOperands
(int count, Litmus litmus) Returns whether the given operands are valid.Methods inherited from class org.apache.calcite.sql.SqlSpecialOperator
getSyntax
Methods inherited from class org.apache.calcite.sql.SqlOperator
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, deriveType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getNameAsId, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getStrongPolicyInference, hashCode, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateCall, validateOperands
-
Field Details
-
VALUE_OPERAND
public static final int VALUE_OPERANDOrdinal of the 'value' operand.- See Also:
-
LOWER_OPERAND
public static final int LOWER_OPERANDOrdinal of the 'lower' operand.- See Also:
-
UPPER_OPERAND
public static final int UPPER_OPERANDOrdinal of the 'upper' operand.- See Also:
-
flag
-
-
Constructor Details
-
SqlBetweenOperator
-
-
Method Details
-
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
-
isNegated
public boolean isNegated()Returns whether this is 'NOT' variant of an operator.- See Also:
-
not
Description copied from class:SqlOperator
Returns the operator that is the logical inverse of this operator.For example,
SqlStdOperatorTable.LIKE.not()
returnsSqlStdOperatorTable.NOT_LIKE
, and vice versa.By default, returns
null
, which means there is no inverse operator.- Overrides:
not
in classSqlOperator
- See Also:
-
inferReturnType
Description copied from class:SqlOperator
Infers the return type of an invocation of this operator; only called after the number and types of operands have already been validated. Subclasses must either override this method or supply an instance ofSqlReturnTypeInference
to the constructor.- Overrides:
inferReturnType
in classSqlOperator
- Parameters:
opBinding
- description of invocation (not necessarily aSqlCall
)- Returns:
- inferred return type
-
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
-
getName
- Overrides:
getName
in classSqlOperator
-
unparse
Description copied from class:SqlOperator
Writes a SQL representation of a call to this operator to a writer, including parentheses if the operators on either side are of greater precedence.The default implementation of this method delegates to
SqlSyntax.unparse(org.apache.calcite.sql.SqlWriter, org.apache.calcite.sql.SqlOperator, org.apache.calcite.sql.SqlCall, int, int)
.- Overrides:
unparse
in classSqlInfixOperator
-
reduceExpr
public SqlSpecialOperator.ReduceResult reduceExpr(int opOrdinal, SqlSpecialOperator.TokenSequence list) Description copied from class:SqlSpecialOperator
Reduces a list of operators and arguments according to the rules of precedence and associativity. Returns the ordinal of the node which replaced the expression.The default implementation throws
UnsupportedOperationException
.- Overrides:
reduceExpr
in classSqlSpecialOperator
- Parameters:
opOrdinal
- indicating the ordinal of the current operator in the list on which a possible reduction can be madelist
- List of alternatingSqlParserUtil.ToTreeListItem
andSqlNode
- Returns:
- ordinal of the node which replaced the expression
-