Package org.apache.calcite.sql.fun
Class SqlTimestampAddFunction
java.lang.Object
org.apache.calcite.sql.SqlOperator
org.apache.calcite.sql.SqlFunction
org.apache.calcite.sql.fun.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
Modifier and TypeMethodDescriptionstatic org.apache.calcite.rel.type.RelDataTypededuceType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, @Nullable org.apache.calcite.avatica.util.TimeUnit timeUnit, org.apache.calcite.rel.type.RelDataType operandType1, org.apache.calcite.rel.type.RelDataType operandType2) voidvalidateCall(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidator validator, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.validate.SqlValidatorScope operandScope) Methods inherited from class org.apache.calcite.sql.SqlFunction
deriveType, getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, getSyntax, isQuantifierAllowed, unparse, validateQuantifierMethods 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, deriveOperandType, 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 Details
-
deduceType
public static org.apache.calcite.rel.type.RelDataType deduceType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, @Nullable org.apache.calcite.avatica.util.TimeUnit timeUnit, org.apache.calcite.rel.type.RelDataType operandType1, org.apache.calcite.rel.type.RelDataType operandType2) -
validateCall
public void validateCall(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidator validator, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.validate.SqlValidatorScope operandScope) - Overrides:
validateCallin classorg.apache.calcite.sql.SqlFunction
-