Package org.apache.calcite.sql.fun
Class SqlItemOperator
java.lang.Object
org.apache.calcite.sql.SqlOperator
org.apache.calcite.sql.SqlSpecialOperator
org.apache.calcite.sql.fun.SqlItemOperator
The item operator 
[ ... ], used to access a given element of an
 array, map or struct. For example, myArray[3], "myMap['foo']",
 myStruct[2] or myStruct['fieldName'].- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.calcite.sql.SqlSpecialOperatorSqlSpecialOperator.ReduceResult, SqlSpecialOperator.TokenSequence
- 
Field SummaryFieldsFields inherited from class org.apache.calcite.sql.SqlOperatorkind, MDX_PRECEDENCE, NL
- 
Constructor SummaryConstructorsConstructorDescriptionSqlItemOperator(String name, SqlSingleOperandTypeChecker operandTypeChecker, int offset, boolean safe) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleancheckOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure) Checks that the operand values in aSqlCallto this operator are valid.getAllowedSignatures(String name) Returns a string describing the expected operand types of a call, e.g.Returns a constraint on the number of operands expected by this operator.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.reduceExpr(int ordinal, 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.Methods inherited from class org.apache.calcite.sql.SqlSpecialOperatorgetSyntaxMethods inherited from class org.apache.calcite.sql.SqlOperatoracceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, deriveType, equals, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getNameAsId, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getSqlCallFactory, getStrongPolicyInference, hashCode, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateCall, validateOperands, validRexOperands
- 
Field Details- 
offsetpublic final int offset
- 
safepublic final boolean safe
 
- 
- 
Constructor Details- 
SqlItemOperatorpublic SqlItemOperator(String name, SqlSingleOperandTypeChecker operandTypeChecker, int offset, boolean safe) 
 
- 
- 
Method Details- 
reduceExprpublic SqlSpecialOperator.ReduceResult reduceExpr(int ordinal, 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 class- SqlSpecialOperator
- Parameters:
- ordinal- indicating the ordinal of the current operator in the list on which a possible reduction can be made
- list- List of alternating- SqlParserUtil.ToTreeListItemand- SqlNode
- Returns:
- ordinal of the node which replaced the expression
 
- 
unparseDescription 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 class- SqlOperator
 
- 
getOperandCountRangeDescription 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 class- SqlOperator
- Returns:
- acceptable range
 
- 
checkOperandTypesDescription 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 class- SqlOperator
- Parameters:
- callBinding- description of call
- throwOnFailure- whether to throw an exception if check fails (otherwise returns false in that case)
- Returns:
- whether check succeeded
 
- 
getOperandTypeChecker- Overrides:
- getOperandTypeCheckerin class- SqlOperator
 
- 
getAllowedSignaturesDescription copied from class:SqlOperatorReturns a string describing the expected operand types of a call, e.g. "SUBSTRING(VARCHAR, INTEGER, INTEGER)" where the name (SUBSTRING in this example) can be replaced by a specified name.- Overrides:
- getAllowedSignaturesin class- SqlOperator
 
- 
inferReturnTypeDescription copied from class:SqlOperatorInfers the return type of an invocation of this operator; only called after the number and types of operands have already been validated. Subclasses must either override this method or supply an instance ofSqlReturnTypeInferenceto the constructor.- Overrides:
- inferReturnTypein class- SqlOperator
- Parameters:
- opBinding- description of invocation (not necessarily a- SqlCall)
- Returns:
- inferred return type
 
 
-