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 Summary
Nested classes/interfaces inherited from class org.apache.calcite.sql.SqlSpecialOperator
SqlSpecialOperator.ReduceResult, SqlSpecialOperator.TokenSequence - 
Field Summary
FieldsFields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL - 
Constructor Summary
ConstructorsConstructorDescriptionSqlItemOperator(String name, SqlSingleOperandTypeChecker operandTypeChecker, int offset, boolean safe)  - 
Method Summary
Modifier 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.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, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getNameAsId, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getSqlCallFactory, getStrongPolicyInference, hashCode, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSafeOperator, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateCall, validateOperands, validRexOperands 
- 
Field Details
- 
offset
public final int offset - 
safe
public final boolean safe 
 - 
 - 
Constructor Details
- 
SqlItemOperator
public SqlItemOperator(String name, SqlSingleOperandTypeChecker operandTypeChecker, int offset, boolean safe)  
 - 
 - 
Method Details
- 
reduceExpr
public 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 classSqlSpecialOperator- Parameters:
 ordinal- 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
 
 - 
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
 - 
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
 
 - 
getOperandTypeChecker
- Overrides:
 getOperandTypeCheckerin classSqlOperator
 - 
getAllowedSignatures
Description 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 classSqlOperator
 - 
inferReturnType
Description 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 classSqlOperator- Parameters:
 opBinding- description of invocation (not necessarily aSqlCall)- Returns:
 - inferred return type
 
 
 -