xuyangzhong commented on a change in pull request #17436:
URL: https://github.com/apache/flink/pull/17436#discussion_r732509497
##########
File path:
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/expressions/TemporalTypesTest.scala
##########
@@ -1116,6 +1117,29 @@ class TemporalTypesTest extends ExpressionTestBase {
"1437699600")
}
+ /**
+ * now Flink only support TIMESTAMP(3) as the return type in TO_TIMESTAMP
+ * See: https://issues.apache.org/jira/browse/FLINK-14925
+ */
+ @Test
+ def testToTimeStampFunctionWithHighPrecision(): Unit = {
+ testSqlApi(
+ "TO_TIMESTAMP('1970-01-01 00:00:00.123456789')",
+ "1970-01-01 00:00:00.123")
+
+ testSqlApi(
+ "TO_TIMESTAMP('1970-01-01 00:00:00.12345', 'yyyy-MM-dd HH:mm:ss.SSSSS')",
+ "1970-01-01 00:00:00.123")
+
+ testSqlApi(
+ "TO_TIMESTAMP('20000202 59:59.1234567', 'yyyyMMdd mm:ss.SSSSSSS')",
+ "2000-02-02 00:59:59.123")
+
+ testSqlApi(
+ "TO_TIMESTAMP('1234567', 'SSSSSSS')",
+ "1970-01-01 00:00:00.123")
+ }
+
@Test
def testHighPrecisionTimestamp(): Unit = {
// EXTRACT should support millisecond/microsecond/nanosecond
Review comment:
These test cases will fail because an extra rule
"CoreRules.PROJECT_REDUCE_EXPRESSIONS" is added into the test builder. And the
new rule will truncate the timestamp(n) to timestamp(3). (see
https://issues.apache.org/jira/browse/FLINK-14925). In actual Flink sql, these
test cases will also fail. So I think this is unreasonable and we should keep
TIMESTAMP(3) now.(Flink now supports)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]