snuyanzin commented on code in PR #25759:
URL: https://github.com/apache/flink/pull/25759#discussion_r1887280700


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/TimeFunctionsITCase.java:
##########
@@ -732,6 +764,39 @@ private Stream<TestSetSpec> floorTestCases() {
                                 $("f2").floor(TimeIntervalUnit.MILLENNIUM),
                                 "FLOOR(f2 TO MILLENNIUM)",
                                 LocalDateTime.of(2001, 1, 1, 0, 0),
-                                TIMESTAMP().nullable()));
+                                TIMESTAMP().nullable())
+                        .testResult(
+                                $("f2").cast(TIMESTAMP_LTZ(3))
+                                        .floor(TimeIntervalUnit.SECOND)
+                                        .cast(STRING()),
+                                "CAST(FLOOR(CAST(f2 AS TIMESTAMP_LTZ(3)) TO 
SECOND) AS STRING)",
+                                formatAsTimestamp(LocalDateTime.of(2020, 2, 
29, 1, 56, 59, 0)),
+                                STRING().nullable())
+                        .testResult(
+                                $("f2").cast(TIMESTAMP_LTZ(3))
+                                        .floor(TimeIntervalUnit.MINUTE)
+                                        .cast(STRING()),
+                                "CAST(FLOOR(CAST(f2 AS TIMESTAMP_LTZ(3)) TO 
MINUTE) AS STRING)",
+                                formatAsTimestamp(LocalDateTime.of(2020, 2, 
29, 1, 56, 0, 0)),
+                                STRING().nullable())
+                        .testResult(
+                                $("f2").cast(TIMESTAMP_LTZ(3))
+                                        .floor(TimeIntervalUnit.HOUR)
+                                        .cast(STRING()),
+                                "CAST(FLOOR(CAST(f2 AS TIMESTAMP_LTZ(3)) TO 
HOUR) AS STRING)",
+                                formatAsTimestamp(LocalDateTime.of(2020, 2, 
29, 1, 0, 0, 0)),
+                                STRING().nullable())
+                        .testResult(
+                                $("f2").cast(TIMESTAMP_LTZ(3))
+                                        .floor(TimeIntervalUnit.MILLISECOND)
+                                        .cast(STRING()),
+                                "CAST(FLOOR(CAST(f2 AS TIMESTAMP_LTZ(3)) TO 
MILLISECOND) AS STRING)",
+                                formatAsTimestamp(
+                                        LocalDateTime.of(2020, 2, 29, 1, 56, 
59, 987_000_000)),
+                                STRING().nullable()));
+    }
+
+    private static String formatAsTimestamp(LocalDateTime dateTime) {
+        return dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd' 
'HH:mm:ss.SSS"));

Review Comment:
   One last comment
   extract this into a separate constant
   ```java
   DateTimeFormatter.ofPattern("yyyy-MM-dd' 'HH:mm:ss.SSS")
   ```



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