Class SqlDatePartFunction

  • public class SqlDatePartFunction
    extends SqlFunction
    SqlDatePartFunction represents the SQL:1999 standard YEAR, QUARTER, MONTH and DAY functions.
    • Field Detail

      • timeUnit

        private final org.apache.calcite.avatica.util.TimeUnit timeUnit
    • Constructor Detail

      • SqlDatePartFunction

        public SqlDatePartFunction​(java.lang.String name,
                                   org.apache.calcite.avatica.util.TimeUnit timeUnit)
    • Method Detail

      • rewriteCall

        public SqlNode rewriteCall​(SqlValidator validator,
                                   SqlCall call)
        Description copied from class: SqlOperator
        Rewrites a call to this operator. Some operators are implemented as trivial rewrites (e.g. NULLIF becomes CASE). However, we don't do this at createCall time because we want to preserve the original SQL syntax as much as possible; instead, we do this before the call is validated (so the trivial operator doesn't need its own implementation of type derivation methods). The default implementation is to just return the original call without any rewrite.
        rewriteCall in class SqlOperator
        validator - Validator
        call - Call to be rewritten
        rewritten call
      • 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.
        getSignatureTemplate in class SqlOperator
        operandsCount - is used with functions that can take a variable number of operands
        signature template, or null to indicate that a default template will suffice
      • checkOperandTypes

        public boolean checkOperandTypes​(SqlCallBinding callBinding,
                                         boolean throwOnFailure)
        Description copied from class: SqlOperator
        Checks that the operand values in a SqlCall to this operator are valid. Subclasses must either override this method or supply an instance of SqlOperandTypeChecker to the constructor.
        checkOperandTypes in class SqlOperator
        callBinding - description of call
        throwOnFailure - whether to throw an exception if check fails (otherwise returns false in that case)
        whether check succeeded