Class SqlTimestampAddFunction


  • public class SqlTimestampAddFunction
    extends org.apache.calcite.sql.SqlFunction
    The TIMESTAMPADD function, which adds an interval to a datetime (TIMESTAMP, TIME or DATE).

    The SQL syntax is

    TIMESTAMPADD(timestamp interval, quantity, datetime)

    The interval time unit can one of the following literals:

    • NANOSECOND (and synonym SQL_TSI_FRAC_SECOND)
    • MICROSECOND (and synonyms SQL_TSI_MICROSECOND, FRAC_SECOND)
    • SECOND (and synonym SQL_TSI_SECOND)
    • MINUTE (and synonym SQL_TSI_MINUTE)
    • HOUR (and synonym SQL_TSI_HOUR)
    • DAY (and synonym SQL_TSI_DAY)
    • WEEK (and synonym SQL_TSI_WEEK)
    • MONTH (and synonym SQL_TSI_MONTH)
    • QUARTER (and synonym SQL_TSI_QUARTER)
    • YEAR (and synonym SQL_TSI_YEAR)

    Returns modified datetime.

    This class was copied over from Calcite to fix the return type deduction issue on timestamp with local time zone type (CALCITE-4698).

    • Field Summary

      • Fields inherited from class org.apache.calcite.sql.SqlOperator

        kind, MDX_PRECEDENCE, NL
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.apache.calcite.rel.type.RelDataType deduceType​(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, org.apache.calcite.avatica.util.TimeUnit timeUnit, org.apache.calcite.rel.type.RelDataType intervalType, org.apache.calcite.rel.type.RelDataType datetimeType)  
      • Methods inherited from class org.apache.calcite.sql.SqlFunction

        deriveType, getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, getSyntax, isQuantifierAllowed, unparse, validateCall, validateQuantifier
      • Methods inherited from class org.apache.calcite.sql.SqlOperator

        acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, 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
    • Method Detail

      • deduceType

        public static org.apache.calcite.rel.type.RelDataType deduceType​(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory,
                                                                         org.apache.calcite.avatica.util.TimeUnit timeUnit,
                                                                         org.apache.calcite.rel.type.RelDataType intervalType,
                                                                         org.apache.calcite.rel.type.RelDataType datetimeType)