GitHub user xueyumusic opened a pull request: https://github.com/apache/flink/pull/6282
[FLINK-6847][FLINK-6813][Table Api & Sql] TimestampDiff table api and sql support ## What is the purpose of the change This PR propose to add TimestampDiff sql and table Api. Sql format is like `TIMESTAMP(DAY, DATE '2018-07-03', DATE '2018-07-04')`, was explained and based on https://github.com/apache/flink/pull/4117 Table Api signature is like `timestampDiff(TimeIntervalUnit.DAY, '2018-07-03'.toDate, '2018-07-04'.toDate)` ## Brief change log - *modify `generateTemporalPlusMinus` in `ScalarOperators.scala` to support sql code gen* - *add `timestampDiff` api in `time.scala`* - *add timestampDiff expr string parse in `ExpressionParser.scala`* ## Verifying this change This change added tests and can be verified as follows: *(example:)* - *add tests to verify sql and table api, in various types combine of unit(YEAR, MONTH...SECOND) and datetime(DATE or TIMESTAMP)* - *add validation tests * ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): (no) - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no) - The serializers: (no) - The runtime per-record code paths (performance sensitive): (no) - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no) - The S3 file system connector: (no) ## Documentation - Does this pull request introduce a new feature? (yes) - If yes, how is the feature documented? (docs / JavaDocs) You can merge this pull request into a Git repository by running: $ git pull https://github.com/xueyumusic/flink timestampDiff Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/6282.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #6282 ---- commit 462060f8854d19a355bcf4cc2fd54a2200f3e35b Author: xueyu <278006819@...> Date: 2018-07-08T10:50:06Z timestampDiff table api and sql ---- ---