public class SqlDotOperator extends SqlSpecialOperator
., used to access a field of a
record. For example, a.b.SqlSpecialOperator.ReduceResult, SqlSpecialOperator.TokenSequencekind, MDX_PRECEDENCE, NL| Constructor and Description |
|---|
SqlDotOperator() |
| 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. |
boolean |
checkOperandTypes(SqlCallBinding callBinding,
boolean throwOnFailure)
Checks that the operand values in a
SqlCall to this operator are
valid. |
RelDataType |
deriveType(SqlValidator validator,
SqlValidatorScope scope,
SqlCall call)
Derives the type of a call to this operator.
|
String |
getAllowedSignatures(String name)
Returns a string describing the expected operand types of a call, e.g.
|
private SqlSingleOperandTypeChecker |
getChecker(RelDataType operandType) |
SqlOperandCountRange |
getOperandCountRange()
Returns a constraint on the number of operands expected by this operator.
|
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.
|
SqlSpecialOperator.ReduceResult |
reduceExpr(int ordinal,
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.
|
getSyntaxacceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getNameAsId, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, leftPrec, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperandspublic SqlSpecialOperator.ReduceResult reduceExpr(int ordinal, SqlSpecialOperator.TokenSequence list)
SqlSpecialOperatorThe default implementation throws
UnsupportedOperationException.
reduceExpr in class SqlSpecialOperatorordinal - indicating the ordinal of the current operator in the list
on which a possible reduction can be madelist - List of alternating
SqlParserUtil.ToTreeListItem and
SqlNodepublic 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 SqlOperandCountRange getOperandCountRange()
SqlOperatorSqlOperandTypeChecker associated with this
operator.getOperandCountRange in class SqlOperatorpublic <R> void acceptCall(SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler)
SqlOperatorSqlVisitor, 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 SqlOperatorvisitor - 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)
SqlOperatorThis 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 SqlOperatorvalidator - Validatorscope - Scope of validationcall - Call to this operatorpublic 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 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)private SqlSingleOperandTypeChecker getChecker(RelDataType operandType)
public String getAllowedSignatures(String name)
SqlOperatorgetAllowedSignatures in class SqlOperatorpublic RelDataType inferReturnType(SqlOperatorBinding opBinding)
SqlOperatorSqlReturnTypeInference to the constructor.inferReturnType in class SqlOperatoropBinding - description of invocation (not necessarily a
SqlCall)Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.