hackergin commented on code in PR #24849:
URL: https://github.com/apache/flink/pull/24849#discussion_r1616511114


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/IntervalFreshness.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.catalog;
+
+import org.apache.flink.annotation.PublicEvolving;
+
+import java.util.Objects;
+
+/**
+ * The {@link IntervalFreshness} represents freshness definition of {@link
+ * CatalogMaterializedTable}. It encapsulates the string interval value along 
with time unit,
+ * allowing for flexible representation of different freshness type. Moreover, 
it can provide
+ * detailed raw information for some specific operations.
+ */
+@PublicEvolving
+public class IntervalFreshness {
+
+    private final String interval;
+    private final TimeUnit timeUnit;
+
+    public IntervalFreshness(String interval, TimeUnit timeUnit) {
+        this.interval = interval;

Review Comment:
   For constructors, I think we can provide constructor methods like Duration 
does, such as second, minute, day: Duration.ofSeconds, Duration.ofHours, 
Duration.ofDays.



##########
flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/catalog/CatalogBaseTableResolutionTest.java:
##########
@@ -424,7 +424,8 @@ private static Map<String, String> 
catalogMaterializedTableAsProperties() throws
         properties.put("schema.3.comment", "");
         properties.put("schema.primary-key.name", "primary_constraint");
         properties.put("schema.primary-key.columns", "id");
-        properties.put("freshness", "PT30S");
+        properties.put("freshness-interval", "30");

Review Comment:
   The configuration built here corresponds to the testPropertyDeSerialization 
test, which can also be modified.



##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/IntervalFreshness.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.catalog;
+
+import org.apache.flink.annotation.PublicEvolving;
+
+import java.util.Objects;
+
+/**
+ * The {@link IntervalFreshness} represents freshness definition of {@link
+ * CatalogMaterializedTable}. It encapsulates the string interval value along 
with time unit,
+ * allowing for flexible representation of different freshness type. Moreover, 
it can provide
+ * detailed raw information for some specific operations.
+ */
+@PublicEvolving
+public class IntervalFreshness {
+
+    private final String interval;
+    private final TimeUnit timeUnit;
+
+    public IntervalFreshness(String interval, TimeUnit timeUnit) {

Review Comment:
   I'm curious why it's a String here. If it were an int, we could validate the 
legality of the interval before converting it into IntervalFreshness.



-- 
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-unsubscr...@flink.apache.org

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

Reply via email to