You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/05/03 14:34:25 UTC

[GitHub] [flink] snuyanzin commented on a diff in pull request #17677: [FLINK-24766][table] Ceiling/flooring dates to day returns wrong results

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


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/TimeFunctionsITCase.java:
##########
@@ -425,4 +430,304 @@ private Stream<TestSetSpec> temporalOverlapsTestCases() {
                                 temporalOverlaps($("f1"), $("f0"), $("f1"), $("f0")),
                                 "TEMPORAL_OVERLAPS requires 2nd argument 'leftTemporal' to be DATETIME or INTERVAL type, but is INT"));
     }
+
+    private Stream<TestSetSpec> ceilTestCases() {
+        return Stream.of(
+                TestSetSpec.forFunction(BuiltInFunctionDefinitions.FLOOR)
+                        .onFieldsWithData(
+                                LocalTime.of(11, 22, 33),
+                                LocalDate.of(1990, 10, 14),
+                                LocalDateTime.of(2020, 2, 29, 1, 56, 59, 987654321))
+                        .andDataTypes(TIME(), DATE(), TIMESTAMP())
+                        .testResult(
+                                $("f0").ceil(TimeIntervalUnit.MILLISECOND),
+                                "CEIL(f0 TO MILLISECOND)",
+                                LocalTime.of(11, 22, 33),
+                                TIME().nullable())
+                        .testResult(
+                                $("f1").ceil(TimeIntervalUnit.MILLISECOND),
+                                "CEIL(f1 TO MILLISECOND)",
+                                LocalDate.of(1990, 10, 14),
+                                DATE().nullable())
+                        .testResult(
+                                $("f2").ceil(TimeIntervalUnit.MILLISECOND),
+                                "CEIL(f2 TO MILLISECOND)",
+                                LocalDateTime.of(2020, 2, 29, 1, 56, 59, 987_000_000),

Review Comment:
   Good catch, thank you, fixed that



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org