walterddr commented on a change in pull request #8746: [hotfix][FLINK-11120][table]fix the bug of timestampadd handles time URL: https://github.com/apache/flink/pull/8746#discussion_r321954993
########## File path: flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/expressions/ScalarFunctionsTest.scala ########## @@ -3572,6 +3572,26 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { "'2016-03-31'.toDate - 1.week", "timestampadd(WEEK, -1, date '2016-03-31')", "2016-03-24") + + // TIMESTAMPADD with time; returns a time value.The interval is positive. + testSqlApi("TIMESTAMPADD(SECOND, 1, time '23:59:59')", "00:00:00") + testSqlApi("TIMESTAMPADD(MINUTE, 1, time '00:00:00')", "00:01:00") + testSqlApi("TIMESTAMPADD(MINUTE, 1, time '23:59:59')", "00:00:59") + testSqlApi("TIMESTAMPADD(HOUR, 1, time '23:59:59')", "00:59:59") + testSqlApi("TIMESTAMPADD(DAY, 15, time '23:59:59')", "23:59:59") + testSqlApi("TIMESTAMPADD(WEEK, 3, time '23:59:59')", "23:59:59") + testSqlApi("TIMESTAMPADD(MONTH, 6, time '23:59:59')", "23:59:59") + testSqlApi("TIMESTAMPADD(QUARTER, 1, time '23:59:59')", "23:59:59") + testSqlApi("TIMESTAMPADD(YEAR, 10, time '23:59:59')", "23:59:59") + // TIMESTAMPADD with time; returns a time value .The interval is negative. + testSqlApi("TIMESTAMPADD(SECOND, -1, time '00:00:00')", "23:59:59") Review comment: I just double checked, seems like negative interval is not supported in `flink-table-planner` (due to the "-1" operator is the result of a multiplication, thus typed as `TimeInterval<Long>` instead of `...<Integer>`. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services