hanyuzheng7 commented on code in PR #25897:
URL: https://github.com/apache/flink/pull/25897#discussion_r1909386210


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/TimeFunctionsITCase.java:
##########
@@ -588,35 +588,51 @@ private Stream<TestSetSpec> ceilTestCases() {
                                 LocalDateTime.of(3001, 1, 1, 0, 0),
                                 TIMESTAMP().nullable())
                         .testResult(
-                                $("f3").cast(TIMESTAMP_LTZ(3))
+                                $("f3").cast(TIMESTAMP_LTZ(9))
                                         .ceil(TimeIntervalUnit.HOUR)
                                         .cast(STRING()),
-                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(3)) TO 
HOUR) AS STRING)",
+                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(9)) TO 
HOUR) AS STRING)",
                                 LocalDateTime.of(2021, 9, 24, 10, 0, 0, 0)
                                         .format(TIMESTAMP_FORMATTER),
                                 STRING().nullable())
                         .testResult(
-                                $("f3").cast(TIMESTAMP_LTZ(3))
+                                $("f3").cast(TIMESTAMP_LTZ(9))
                                         .ceil(TimeIntervalUnit.MINUTE)
                                         .cast(STRING()),
-                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(3)) TO 
MINUTE) AS STRING)",
+                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(9)) TO 
MINUTE) AS STRING)",
                                 LocalDateTime.of(2021, 9, 24, 9, 21, 0, 0)
                                         .format(TIMESTAMP_FORMATTER),
                                 STRING().nullable())
                         .testResult(
-                                $("f3").cast(TIMESTAMP_LTZ(3))
+                                $("f3").cast(TIMESTAMP_LTZ(9))
                                         .ceil(TimeIntervalUnit.SECOND)
                                         .cast(STRING()),
-                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(3)) TO 
SECOND) AS STRING)",
+                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(9)) TO 
SECOND) AS STRING)",
                                 LocalDateTime.of(2021, 9, 24, 9, 20, 51, 0)
                                         .format(TIMESTAMP_FORMATTER),
                                 STRING().nullable())
                         .testResult(
-                                $("f3").cast(TIMESTAMP_LTZ(3))
+                                $("f3").cast(TIMESTAMP_LTZ(9))
                                         .ceil(TimeIntervalUnit.MILLISECOND)
                                         .cast(STRING()),
-                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(3)) TO 
MILLISECOND) AS STRING)",
-                                LocalDateTime.of(2021, 9, 24, 9, 20, 50, 
924_000_000)
+                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(9)) TO 
MILLISECOND) AS STRING)",
+                                LocalDateTime.of(2021, 9, 24, 9, 20, 50, 
925_000_000)
+                                        .format(TIMESTAMP_FORMATTER),
+                                STRING().nullable())
+                        .testResult(
+                                $("f3").cast(TIMESTAMP_LTZ(9))
+                                        .ceil(TimeIntervalUnit.MICROSECOND)
+                                        .cast(STRING()),
+                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(9)) TO 
MICROSECOND) AS STRING)",
+                                LocalDateTime.of(2021, 9, 24, 9, 20, 50, 
924_326_000)
+                                        .format(TIMESTAMP_FORMATTER),
+                                STRING().nullable())
+                        .testResult(
+                                $("f3").cast(TIMESTAMP_LTZ(9))
+                                        .ceil(TimeIntervalUnit.NANOSECOND)
+                                        .cast(STRING()),
+                                "CAST(CEIL(CAST(f3 AS TIMESTAMP_LTZ(9)) TO 
NANOSECOND) AS STRING)",
+                                LocalDateTime.of(2021, 9, 24, 9, 20, 50, 
924_325_471)

Review Comment:
   But the issue is `f2` use TIMESTAMP()
   ```
    .onFieldsWithData(
                                   // 
https://issues.apache.org/jira/browse/FLINK-17224
                                   // Fractional seconds are lost
                                   LocalTime.of(11, 22, 33),
                                   LocalDate.of(1990, 10, 14),
                                   LocalDateTime.of(2020, 2, 29, 1, 56, 59, 
987654321),
                                   LocalDateTime.of(2021, 9, 24, 9, 20, 50, 
924325471))
                           .andDataTypes(TIME(), DATE(), TIMESTAMP(), 
TIMESTAMP(9))
   ```
   , which means the precision is 6. so the data deliver to `TimestampData` is 
   999_999_000. If we change the TIMESTAMP() for f2 to TIMESTAMP(9), all other 
tests will also change.
   I think we can change f3 to `LocalDateTime.of(2021, 9, 24, 9, 20, 50, 
999_999_471)`



-- 
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]

Reply via email to