snuyanzin commented on code in PR #25897:
URL: https://github.com/apache/flink/pull/25897#discussion_r1939157227
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/DateTimeUtils.java:
##########
@@ -1275,7 +1314,31 @@ public static long timestampCeil(TimeUnitRange range,
long ts, TimeZone tz) {
int days = (int) (utcTs / MILLIS_PER_DAY + EPOCH_JULIAN);
return julianDateFloor(range, days, false) * MILLIS_PER_DAY -
offset;
default:
- // for MINUTE and SECONDS etc...,
+ // it is more effective to use arithmetic Method
+ throw new AssertionError(range);
+ }
+ }
+
+ public static int timestampCeilForHighPrecision(TimeUnitRange range, int
ns) {
+ switch (range) {
+ case NANOSECOND:
+ return ns;
+ case MICROSECOND:
+ return ceilForHighPrecision(ns);
+ case MILLISECOND:
Review Comment:
here and for `timestampFloorForHighPrecision` we have only one line different
can we make logic more generic here?
--
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]