wuchong commented on a change in pull request #14620:
URL: https://github.com/apache/flink/pull/14620#discussion_r556248368
##########
File path:
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/expressions/TemporalTypesTest.scala
##########
@@ -674,6 +675,35 @@ class TemporalTypesTest extends ExpressionTestBase {
//testSqlApi("CEIL(TIMESTAMP '2018-03-20 06:10:31' TO HOUR)", "2018-03-20
07:00:00.000")
}
+ @Test
+ def testLocalDateTimeInUTC(): Unit = {
+ config.setLocalTimeZone(ZoneId.of("UTC"))
+
+ val formattedLocalDateTime = LocalDateTime
+ .now(ZoneId.of("UTC"))
+ .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+
+ // the LOCALTIMESTAMP function is not deterministic, thus we
+ // use following pattern to check it return SQL timestamp in session time
zone UTC
+ testSqlApi(
+ s"TIMESTAMPDIFF(MINUTE, TIMESTAMP '$formattedLocalDateTime',
LOCALTIMESTAMP) <= 1",
+ "true")
+ }
+
+ @Test
+ def testLocalDateTimeInShanghai(): Unit = {
Review comment:
Could you add these tests into
`NonDeterministicTests#testLocalTimestamp`?
Besides, we may also need to test `LOCALTIME`?
----------------------------------------------------------------
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:
[email protected]