public class SqlBetweenOperator extends SqlInfixOperator
Syntax:
X [NOT] BETWEEN [ASYMMETRIC | SYMMETRIC] Y AND
Z
If the asymmetric/symmeteric 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.
Modifier and Type | Class and Description |
---|---|
private static class |
SqlBetweenOperator.AndFinder
Finds an AND operator in an expression.
|
static class |
SqlBetweenOperator.Flag
Defines the "SYMMETRIC" and "ASYMMETRIC" keywords.
|
SqlSpecialOperator.ReduceResult, SqlSpecialOperator.TokenSequence
Modifier and Type | Field and Description |
---|---|
private static java.lang.String[] |
BETWEEN_NAMES |
SqlBetweenOperator.Flag |
flag |
private static SqlWriter.FrameType |
FRAME_TYPE |
static int |
LOWER_OPERAND
Ordinal of the 'lower' operand.
|
private boolean |
negated
If true the call represents 'NOT BETWEEN'.
|
private static java.lang.String[] |
NOT_BETWEEN_NAMES |
private static SqlOperandTypeChecker |
OTC_CUSTOM
Custom operand-type checking strategy.
|
static int |
UPPER_OPERAND
Ordinal of the 'upper' operand.
|
static int |
VALUE_OPERAND
Ordinal of the 'value' operand.
|
kind, MDX_PRECEDENCE, NL
Constructor and Description |
---|
SqlBetweenOperator(SqlBetweenOperator.Flag flag,
boolean negated) |
Modifier and Type | Method and Description |
---|---|
private java.util.List<RelDataType> |
collectOperandTypes(SqlValidator validator,
SqlValidatorScope scope,
SqlCall call) |
java.lang.String |
getName() |
java.lang.String |
getSignatureTemplate(int operandsCount)
Returns a template describing how the operator signature is to be built.
|
RelDataType |
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 |
isNegated() |
SqlSpecialOperator.ReduceResult |
reduceExpr(int opOrdinal,
SqlSpecialOperator.TokenSequence list)
Reduces a list of operators and arguments according to the rules of
precedence and associativity.
|
void |
unparse(SqlWriter writer,
SqlCall call,
int leftPrec,
int rightPrec)
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.
|
getSyntax
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, deriveType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getNameAsId, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, hashCode, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, leftPrec, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateCall, validateOperands, validRexOperands
private static final java.lang.String[] BETWEEN_NAMES
private static final java.lang.String[] NOT_BETWEEN_NAMES
public static final int VALUE_OPERAND
public static final int LOWER_OPERAND
public static final int UPPER_OPERAND
private static final SqlOperandTypeChecker OTC_CUSTOM
private static final SqlWriter.FrameType FRAME_TYPE
public final SqlBetweenOperator.Flag flag
private final boolean negated
public SqlBetweenOperator(SqlBetweenOperator.Flag flag, boolean negated)
public boolean isNegated()
private java.util.List<RelDataType> collectOperandTypes(SqlValidator validator, SqlValidatorScope scope, SqlCall call)
public RelDataType inferReturnType(SqlOperatorBinding opBinding)
SqlOperator
SqlReturnTypeInference
to the constructor.inferReturnType
in class SqlOperator
opBinding
- description of invocation (not necessarily a
SqlCall
)public java.lang.String getSignatureTemplate(int operandsCount)
SqlOperator
getSignatureTemplate
in class SqlOperator
operandsCount
- is used with functions that can take a variable
number of operandspublic java.lang.String getName()
getName
in class SqlOperator
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
SqlOperator
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)
.
unparse
in class SqlInfixOperator
public SqlSpecialOperator.ReduceResult reduceExpr(int opOrdinal, SqlSpecialOperator.TokenSequence list)
SqlSpecialOperator
The default implementation throws
UnsupportedOperationException
.
reduceExpr
in class SqlSpecialOperator
opOrdinal
- indicating the ordinal of the current operator in the list
on which a possible reduction can be madelist
- List of alternating
SqlParserUtil.ToTreeListItem
and
SqlNode
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.