Class SqlLikeOperator
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 ...)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.calcite.sql.SqlSpecialOperator
SqlSpecialOperator.ReduceResult, SqlSpecialOperator.TokenSequence -
Field Summary
Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure) Checks that the operand values in aSqlCallto this operator are valid.Returns a constraint on the number of operands expected by this operator.booleanReturns whether this operator matches the case of its operands.booleanReturns whether this is the 'NOT LIKE' 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.voidWrites a SQL representation of a call to this operator to a writer, including parentheses if the operators on either side are of greater precedence.voidvalidateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) Validates a call to this operator.booleanvalidRexOperands(int count, Litmus litmus) Returns whether the given operands are valid.Methods inherited from class org.apache.calcite.sql.SqlSpecialOperator
getSyntaxMethods inherited from class org.apache.calcite.sql.SqlOperator
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, deriveType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getNameAsId, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getSqlCallFactory, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands
-
Method Details
-
isNegated
public boolean isNegated()Returns whether this is the 'NOT LIKE' operator.- Returns:
- whether this is 'NOT LIKE'
- See Also:
-
isCaseSensitive
public boolean isCaseSensitive()Returns whether this operator matches the case of its operands. For example, returns true forLIKEand false forILIKE.- Returns:
- whether this operator matches the case of its operands
-
not
Description copied from class:SqlOperatorReturns 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:
notin classSqlOperator- See Also:
-
getOperandCountRange
Description copied from class:SqlOperatorReturns a constraint on the number of operands expected by this operator. Subclasses may override this method; when they don't, the range is derived from theSqlOperandTypeCheckerassociated with this operator.- Overrides:
getOperandCountRangein classSqlOperator- Returns:
- acceptable range
-
checkOperandTypes
Description copied from class:SqlOperatorChecks that the operand values in aSqlCallto this operator are valid. Subclasses must either override this method or supply an instance ofSqlOperandTypeCheckerto the constructor.- Overrides:
checkOperandTypesin classSqlOperator- Parameters:
callBinding- description of callthrowOnFailure- whether to throw an exception if check fails (otherwise returns false in that case)- Returns:
- whether check succeeded
-
validateCall
public void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) Description copied from class:SqlOperatorValidates a call to this operator.This 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 ofSqlCallnever call this method.- Overrides:
validateCallin classSqlOperator- Parameters:
call- 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 scopes- See Also:
-
validRexOperands
Description copied from class:SqlOperatorReturns 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 inSqlNodeandRexNodeformats (some examples are CAST and AND), and this method throws internal errors, not user errors.- Overrides:
validRexOperandsin classSqlOperator
-
unparse
Description copied from class:SqlOperatorWrites 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:
unparsein classSqlOperator
-
reduceExpr
public SqlSpecialOperator.ReduceResult reduceExpr(int opOrdinal, SqlSpecialOperator.TokenSequence list) Description copied from class:SqlSpecialOperatorReduces 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:
reduceExprin classSqlSpecialOperator- Parameters:
opOrdinal- indicating the ordinal of the current operator in the list on which a possible reduction can be madelist- List of alternatingSqlParserUtil.ToTreeListItemandSqlNode- Returns:
- ordinal of the node which replaced the expression
-