public class SqlAsOperator extends SqlSpecialOperator
AS
operator associates an expression with an alias.SqlSpecialOperator.ReduceResult, SqlSpecialOperator.TokenSequence
kind, MDX_PRECEDENCE, NL
Modifier | Constructor and Description |
---|---|
|
SqlAsOperator()
Creates an AS operator.
|
protected |
SqlAsOperator(java.lang.String name,
SqlKind kind,
int prec,
boolean leftAssoc,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker) |
Modifier and Type | Method and Description |
---|---|
<R> void |
acceptCall(SqlVisitor<R> visitor,
SqlCall call,
boolean onlyExpressions,
SqlBasicVisitor.ArgHandler<R> argHandler)
Accepts a
SqlVisitor , directing an
SqlBasicVisitor.ArgHandler
to visit an operand of a call. |
RelDataType |
deriveType(SqlValidator validator,
SqlValidatorScope scope,
SqlCall call)
Derives the type of a call to this operator.
|
SqlMonotonicity |
getMonotonicity(SqlOperatorBinding call)
Returns whether a call to this operator is monotonic.
|
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, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getNameAsId, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, leftPrec, needsSpace, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
public SqlAsOperator()
protected SqlAsOperator(java.lang.String name, SqlKind kind, int prec, boolean leftAssoc, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker)
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 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 <R> void acceptCall(SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler)
SqlOperator
SqlVisitor
, directing an
SqlBasicVisitor.ArgHandler
to visit an operand of a call.
The argument handler allows fine control about how the operands are visited, and how the results are combined.
acceptCall
in class SqlOperator
visitor
- Visitorcall
- Call to visitonlyExpressions
- If true, ignores operands which are not
expressions. For example, in the call to the
AS
operatorargHandler
- Called for each operandpublic RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call)
SqlOperator
This method is an intrinsic part of the validation process so, unlike
SqlOperator.inferReturnType(org.apache.calcite.sql.SqlOperatorBinding)
, specific operators would not typically override
this method.
deriveType
in class SqlOperator
validator
- Validatorscope
- Scope of validationcall
- Call to this operatorpublic SqlMonotonicity getMonotonicity(SqlOperatorBinding call)
SqlOperator
Default implementation returns SqlMonotonicity.NOT_MONOTONIC
.
getMonotonicity
in class SqlOperator
call
- Call to this operator with particular arguments and information
about the monotonicity of the argumentsCopyright © 2012–2019 The Apache Software Foundation. All rights reserved.