raminqaf commented on code in PR #29690:
URL: https://github.com/apache/flink/pull/29690#discussion_r4453542912


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/casting/CastRulesTest.java:
##########
@@ -2316,7 +2316,24 @@ Stream<CastTestSpecBuilder> testCases() {
                                 VARIANT(),
                                 VARIANT_BUILDER.of(LocalDate.of(2020, 1, 1)),
                                 (int) LocalDate.of(2020, 1, 1).toEpochDay())
-                        .fail(VARIANT(), Variant.newBuilder().of(1), 
TableRuntimeException.class),
+                        // a timestamp keeps its date, in the session time 
zone for a TIMESTAMP_LTZ
+                        .fromCase(
+                                VARIANT(),
+                                CET_CONTEXT,
+                                
VARIANT_BUILDER.of(Instant.parse("2020-01-01T23:30:00Z")),
+                                (int) LocalDate.of(2020, 1, 2).toEpochDay())
+                        // before 1970, the day is still the one the timestamp 
falls on
+                        .fromCase(
+                                VARIANT(),
+                                VARIANT_BUILDER.of(LocalDateTime.of(1969, 12, 
31, 23, 0)),

Review Comment:
   A VARIANT `DATE` is an int32 day count since the epoch, so it spans far more 
than Flink's `DATE` range of `0000-01-01` to `9999-12-31`. A VARIANT 
`TIMESTAMP` is int64 microseconds, about ±292,000 years. Only `TIMESTAMP_NS` is 
narrow, since int64 nanoseconds covers 1677-09-21 to 2262-04-11.



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