Class SqlCastFunction


  • public class SqlCastFunction
    extends SqlFunction
    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 Detail

      • nonMonotonicCasts

        private final com.google.common.collect.SetMultimap<SqlTypeFamily,​SqlTypeFamily> nonMonotonicCasts
        Map of all casts that do not preserve monotonicity.
    • Constructor Detail

      • SqlCastFunction

        public SqlCastFunction()
    • Method Detail

      • inferReturnType

        public RelDataType inferReturnType​(SqlOperatorBinding opBinding)
        Description copied from class: SqlOperator
        Infers 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 of SqlReturnTypeInference to the constructor.
        Overrides:
        inferReturnType in class SqlOperator
        Parameters:
        opBinding - description of invocation (not necessarily a SqlCall)
        Returns:
        inferred return type
      • getSignatureTemplate

        public java.lang.String getSignatureTemplate​(int operandsCount)
        Description copied from class: SqlOperator
        Returns 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:
        getSignatureTemplate in 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
      • checkOperandTypes

        public boolean checkOperandTypes​(SqlCallBinding callBinding,
                                         boolean throwOnFailure)
        Makes 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:
        checkOperandTypes in 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