Package org.apache.calcite.sql.fun
Class SqlCastFunction
java.lang.Object
org.apache.calcite.sql.SqlOperator
org.apache.calcite.sql.SqlFunction
org.apache.calcite.sql.fun.SqlCastFunction
SqlCastFunction. Note that the std functions are really singleton objects,
 because they always get fetched via the StdOperatorTable. So you can't store
 any local info in the class and hence the return type data is maintained in
 operand[1] through the validation phase.
 
Can be used for both SqlCall and
 RexCall.
 Note that the SqlCall has two operands (expression and type),
 while the RexCall has one operand (expression) and the type is
 obtained from RexNode.getType().
- See Also:
- 
- SqlCastOperator
 
- 
Field SummaryFields inherited from class org.apache.calcite.sql.SqlOperatorkind, MDX_PRECEDENCE, NL
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleancheckOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure) Makes sure that the number and types of arguments are allowable.static RelDataTypederiveType(RelDataTypeFactory typeFactory, RelDataType expressionType, RelDataType targetType, boolean safe) Derives the type of "CAST(expression AS targetType)".Returns whether a call to this operator is monotonic.Returns a constraint on the number of operands expected by this operator.getSignatureTemplate(int operandsCount) Returns a template describing how the operator signature is to be built.Returns the syntactic type of this operator, never null.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.SqlFunctionderiveType, getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, isQuantifierAllowed, validateCall, validateQuantifierMethods inherited from class org.apache.calcite.sql.SqlOperatoracceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSqlCallFactory, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
- 
Constructor Details- 
SqlCastFunctionpublic SqlCastFunction()
- 
SqlCastFunction
 
- 
- 
Method Details- 
deriveTypepublic static RelDataType deriveType(RelDataTypeFactory typeFactory, RelDataType expressionType, RelDataType targetType, boolean safe) Derives the type of "CAST(expression AS targetType)".
- 
getSignatureTemplateDescription copied from class:SqlOperatorReturns a template describing how the operator signature is to be built. E.g for the binary + operator the template looks like "{1} {0} {2}" {0} is the operator, subsequent numbers are operands.- Overrides:
- getSignatureTemplatein class- SqlOperator
- Parameters:
- operandsCount- is used with functions that can take a variable number of operands
- Returns:
- signature template, or null to indicate that a default template will suffice
 
- 
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
 
- 
checkOperandTypesMakes sure that the number and types of arguments are allowable. Operators (such as "ROW" and "AS") which do not check their arguments can override this method.- 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
 
- 
getSyntaxDescription copied from class:SqlOperatorReturns the syntactic type of this operator, never null.- Overrides:
- getSyntaxin class- SqlFunction
 
- 
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- SqlFunction
 
- 
getMonotonicityDescription copied from class:SqlOperatorReturns whether a call to this operator is monotonic.Default implementation returns SqlMonotonicity.NOT_MONOTONIC.- Overrides:
- getMonotonicityin class- SqlOperator
- Parameters:
- call- Call to this operator with particular arguments and information about the monotonicity of the arguments
 
 
-