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


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/IntervalFreshness.java:
##########
@@ -42,20 +43,29 @@ public class IntervalFreshness {
     private static final long MINUTE_CRON_UPPER_BOUND = 60;
     private static final long HOUR_CRON_UPPER_BOUND = 24;
 
-    private final int interval;
-    private final TimeUnit timeUnit;
+    private final Interval interval;
 
-    private IntervalFreshness(int interval, TimeUnit timeUnit) {
+    public IntervalFreshness(Interval interval) {
         this.interval = interval;
-        this.timeUnit = timeUnit;
     }
 
     public static IntervalFreshness of(String interval, TimeUnit timeUnit) {
-        final int validateIntervalInput = validateIntervalInput(interval);
-        return new IntervalFreshness(validateIntervalInput, timeUnit);
+        final int validateIntervalInput = 
validateIntervalStringInput(interval);
+        return new IntervalFreshness(Interval.of(validateIntervalInput, 
timeUnit));
     }
 
-    private static int validateIntervalInput(final String interval) {
+    public static IntervalFreshness of(int intervalDuration, TimeUnit 
timeUnit) {
+        validateIntervalIntInput(intervalDuration);
+        return new IntervalFreshness(Interval.of(intervalDuration, timeUnit));
+    }
+
+    public static IntervalFreshness of(Duration duration, TimeUnit timeUnit) {
+        // just check it is positive
+        validateIntervalIntInput((int) duration.toSeconds());

Review Comment:
   renamed



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