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


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/IntervalFreshness.java:
##########
@@ -116,24 +117,17 @@ public Duration toDuration() {
      * Prefers larger units when possible (e.g., 60 seconds → 1 minute).
      */
     public static IntervalFreshness fromDuration(Duration duration) {
-        long totalSeconds = duration.getSeconds();
-
-        long days = duration.toDays();
-        if (days * 24 * 60 * 60 == totalSeconds) {
-            return IntervalFreshness.ofDay(String.valueOf(days));
+        if (duration.equals(duration.truncatedTo(ChronoUnit.DAYS))) {
+            return IntervalFreshness.ofDay(String.valueOf(duration.toDays()));

Review Comment:
   Can we instead use constructor?
   I don't see a reason to serialize it to string and then parse and validate 
again



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