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
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.
-
Field Summary
Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL
-
Method Summary
Modifier and TypeMethodDescriptionstatic RelDataType
deduceType
(RelDataTypeFactory typeFactory, @Nullable org.apache.calcite.avatica.util.TimeUnit timeUnit, RelDataType operandType1, RelDataType operandType2) Deprecated.void
validateCall
(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) Validates a call to this operator.Methods inherited from class org.apache.calcite.sql.SqlFunction
deriveType, getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, getSyntax, isQuantifierAllowed, unparse, 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, 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
@Deprecated public static RelDataType deduceType(RelDataTypeFactory typeFactory, @Nullable org.apache.calcite.avatica.util.TimeUnit timeUnit, RelDataType operandType1, RelDataType operandType2) Deprecated. -
validateCall
public void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) Description copied from class:SqlOperator
Validates a call to this operator.This method should not perform type-derivation or perform validation related related to types. That is done later, by
SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall)
. This method should focus on structural validation.A typical implementation of this method first validates the operands, then performs some operator-specific logic. The default implementation just validates the operands.
This method is the default implementation of
SqlCall.validate(org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.validate.SqlValidatorScope)
; but note that some sub-classes ofSqlCall
never call this method.- Overrides:
validateCall
in classSqlFunction
- Parameters:
call
- the call to this operatorvalidator
- the active validatorscope
- validator scopeoperandScope
- validator scope in which to validate operands to this call; usually equal to scope, but not always because some operators introduce new scopes- See Also:
-