[
https://issues.apache.org/jira/browse/FLINK-6811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
sunjincheng updated FLINK-6811:
-------------------------------
Description:
TIMESTAMPADD(unit,interval,datetime_expr) Adds the integer expression interval
to the date or datetime expression datetime_expr. The unit for interval is
given by the unit argument, which should be one of the following values:
MICROSECOND (microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or
YEAR.
* Syntax:
TIMESTAMPADD(unit,interval,datetime_expr)
* Arguments
**unit: -
**interval: -
**datetime_expr: -
* Return Types
DATAETIME/DATE/TIME
* Example:
SELECT TIMESTAMPADD(month, 1, '2017-05-31') --> '2017-06-30 00:00:00.000'
SELECT TIMESTAMPADD(WEEK,1,'2003-01-02') -> '2003-01-09'
* See more:
** [MySQL|
https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_timestampadd]
Note: Due to the difference of [[org.apache.calcite.rex.Rex Literal]] between
calcite 1.12 and calcite master we should temp close support the construce of
{{TIMESTAMPADD(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER, SqlTypeFamily.DATE)}},
until upgrade to calcite 1.13.
See more:
https://issues.apache.org/jira/browse/CALCITE-1639
https://issues.apache.org/jira/browse/FLINK-6851
See more:
[https://issues.apache.org/jira/browse/CALCITE-1827|https://issues.apache.org/jira/browse/CALCITE-1827]
was:
* Syntax
timestampAdd (datepart SqlTypeFamily.ANY, number:SqlTypeFamily.INTEGER,
date:SqlTypeFamily.TIMESTAMP )
-datepart
Is the part of date to which an integer number is added.
-number
Is an expression that can be resolved to an int that is added to a datepart of
date
-date
Is an expression that can be resolved to a time.
* Example
SELECT timestampAdd(month, 1, '2017-05-31') from tab; --> 2017-06-30
00:00:00.000
Note: Due to the difference of [[org.apache.calcite.rex.Rex Literal]] between
calcite 1.12 and calcite master we should temp close support the construce of
{{TIMESTAMPADD(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER, SqlTypeFamily.DATE)}},
until upgrade to calcite 1.13.
See more:
https://issues.apache.org/jira/browse/CALCITE-1639
https://issues.apache.org/jira/browse/FLINK-6851
See more:
[https://issues.apache.org/jira/browse/CALCITE-1827|https://issues.apache.org/jira/browse/CALCITE-1827]
> Add TIMESTAMPADD supported in SQL
> ---------------------------------
>
> Key: FLINK-6811
> URL: https://issues.apache.org/jira/browse/FLINK-6811
> Project: Flink
> Issue Type: Sub-task
> Components: Table API & SQL
> Reporter: sunjincheng
> Assignee: sunjincheng
>
> TIMESTAMPADD(unit,interval,datetime_expr) Adds the integer expression
> interval to the date or datetime expression datetime_expr. The unit for
> interval is given by the unit argument, which should be one of the following
> values: MICROSECOND (microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH,
> QUARTER, or YEAR.
> * Syntax:
> TIMESTAMPADD(unit,interval,datetime_expr)
> * Arguments
> **unit: -
> **interval: -
> **datetime_expr: -
> * Return Types
> DATAETIME/DATE/TIME
> * Example:
> SELECT TIMESTAMPADD(month, 1, '2017-05-31') --> '2017-06-30 00:00:00.000'
> SELECT TIMESTAMPADD(WEEK,1,'2003-01-02') -> '2003-01-09'
> * See more:
> ** [MySQL|
> https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_timestampadd]
> Note: Due to the difference of [[org.apache.calcite.rex.Rex Literal]] between
> calcite 1.12 and calcite master we should temp close support the construce of
> {{TIMESTAMPADD(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER,
> SqlTypeFamily.DATE)}}, until upgrade to calcite 1.13.
> See more:
> https://issues.apache.org/jira/browse/CALCITE-1639
> https://issues.apache.org/jira/browse/FLINK-6851
> See more:
> [https://issues.apache.org/jira/browse/CALCITE-1827|https://issues.apache.org/jira/browse/CALCITE-1827]
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)