public class SqlLikeOperator extends SqlSpecialOperator
LIKE and SIMILAR
operators.
Syntax of the two operators:
src-value [NOT] LIKE pattern-value [ESCAPE
escape-value]src-value [NOT] SIMILAR pattern-value [ESCAPE
escape-value]NOTE If the NOT clause is present the
parser will generate a
equivalent to NOT (src LIKE pattern ...)
SqlSpecialOperator.ReduceResult, SqlSpecialOperator.TokenSequencekind, MDX_PRECEDENCE, NL| Modifier and Type | Method and Description |
|---|---|
boolean |
checkOperandTypes(SqlCallBinding callBinding,
boolean throwOnFailure)
Checks that the operand values in a
SqlCall to this operator are
valid. |
SqlOperandCountRange |
getOperandCountRange()
Returns a constraint on the number of operands expected by this operator.
|
boolean |
isCaseSensitive()
Returns whether this operator matches the case of its operands.
|
boolean |
isNegated()
Returns whether this is the 'NOT LIKE' operator.
|
SqlOperator |
not()
Returns the operator that is the logical inverse of this operator.
|
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.
|
void |
validateCall(SqlCall call,
SqlValidator validator,
SqlValidatorScope scope,
SqlValidatorScope operandScope)
Validates a call to this operator.
|
boolean |
validRexOperands(int count,
Litmus litmus)
Returns whether the given operands are valid.
|
getSyntaxacceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getNameAsId, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperandspublic boolean isNegated()
not()public boolean isCaseSensitive()
LIKE and false for ILIKE.public SqlOperator not()
SqlOperatorFor example, SqlStdOperatorTable.LIKE.not() returns
SqlStdOperatorTable.NOT_LIKE, and vice versa.
By default, returns null, which means there is no inverse
operator.
not in class SqlOperatorSqlOperator.reverse()public SqlOperandCountRange getOperandCountRange()
SqlOperatorSqlOperandTypeChecker associated with this
operator.getOperandCountRange in class SqlOperatorpublic boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure)
SqlOperatorSqlCall to this operator are
valid. Subclasses must either override this method or supply an instance
of SqlOperandTypeChecker to the constructor.checkOperandTypes in class SqlOperatorcallBinding - description of callthrowOnFailure - whether to throw an exception if check fails
(otherwise returns false in that case)public void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope)
SqlOperatorThis method should not perform type-derivation or perform validation
related related to types. That is done later, by
SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall). This method
should focus on structural validation.
A typical implementation of this method first validates the operands, then performs some operator-specific logic. The default implementation just validates the operands.
This method is the default implementation of SqlCall.validate(org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.validate.SqlValidatorScope);
but note that some sub-classes of SqlCall never call this method.
validateCall in class SqlOperatorcall - the call to this operatorvalidator - the active validatorscope - validator scopeoperandScope - validator scope in which to validate operands to this
call; usually equal to scope, but not always because
some operators introduce new scopesSqlNode.validateExpr(SqlValidator, SqlValidatorScope),
SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall)public boolean validRexOperands(int count,
Litmus litmus)
SqlOperatorfail, 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 in SqlNode and RexNode formats
(some examples are CAST and AND), and this method throws internal errors,
not user errors.
validRexOperands in class SqlOperatorpublic void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
SqlOperatorThe 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 SqlOperatorpublic SqlSpecialOperator.ReduceResult reduceExpr(int opOrdinal, SqlSpecialOperator.TokenSequence list)
SqlSpecialOperatorThe default implementation throws
UnsupportedOperationException.
reduceExpr in class SqlSpecialOperatoropOrdinal - indicating the ordinal of the current operator in the list
on which a possible reduction can be madelist - List of alternating
SqlParserUtil.ToTreeListItem and
SqlNodeCopyright © 2012-2022 Apache Software Foundation. All Rights Reserved.