public class SqlLiteralChainOperator extends SqlSpecialOperator
The string fragments are SqlLiteral
objects, all of the same type,
collected as the operands of an SqlCall
using this operator. After
validation, the fragments will be concatenated into a single literal.
For a chain of SqlCharStringLiteral
objects, a SqlCollation
object is attached only to the head of the
chain.
SqlSpecialOperator.ReduceResult, SqlSpecialOperator.TokenSequence
kind, MDX_PRECEDENCE, NL
Constructor and Description |
---|
SqlLiteralChainOperator() |
Modifier and Type | Method and Description |
---|---|
private boolean |
argTypesValid(SqlCallBinding callBinding) |
boolean |
checkOperandTypes(SqlCallBinding callBinding,
boolean throwOnFailure)
Checks that the operand values in a
SqlCall to this operator are
valid. |
static SqlLiteral |
concatenateOperands(SqlCall call)
Concatenates the operands of a call to this operator.
|
java.lang.String |
getAllowedSignatures(java.lang.String opName)
Returns a string describing the expected operand types of a call, e.g.
|
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.
|
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.
|
getSyntax, reduceExpr
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, deriveType, equals, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getNameAsId, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, leftPrec, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
private boolean argTypesValid(SqlCallBinding callBinding)
public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure)
SqlOperator
SqlCall
to this operator are
valid. Subclasses must either override this method or supply an instance
of SqlOperandTypeChecker
to the constructor.checkOperandTypes
in class SqlOperator
callBinding
- description of callthrowOnFailure
- whether to throw an exception if check fails
(otherwise returns false in that case)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 getAllowedSignatures(java.lang.String opName)
SqlOperator
getAllowedSignatures
in class SqlOperator
public void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope)
SqlOperator
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 of SqlCall
never call this method.
validateCall
in class SqlOperator
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 scopesSqlNode.validateExpr(SqlValidator, SqlValidatorScope)
,
SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall)
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 SqlOperator
public static SqlLiteral concatenateOperands(SqlCall call)
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.