[FLINK-6811][table] Add TIMESTAMPADD supported in SQL #4076
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR I have add
TIMESTAMPADD
supported in SQL. (the semantics keep consistent with calcite)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/FLINK-6851
General
Documentation
Tests & Build
mvn clean verify
has been executed successfully locally or a Travis build has passed