Re: [PR] [FLINK-35425][table-common] Support convert freshness to cron expression in full refresh mode [flink]

2024-05-28 Thread via GitHub


lsyldliu merged PR #24849:
URL: https://github.com/apache/flink/pull/24849


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



Re: [PR] [FLINK-35425][table-common] Support convert freshness to cron expression in full refresh mode [flink]

2024-05-27 Thread via GitHub


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


##
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:
   Considering future extensibility, it may support other types of time units, 
such as `DAY TO HOUR`, `DAY TO SECOND`, which are not directly convertible to 
numeric types, so here it is defined as String type first, which is the widest 
type.
   
   1. https://calcite.apache.org/docs/reference.html



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



Re: [PR] [FLINK-35425][table-common] Support convert freshness to cron expression in full refresh mode [flink]

2024-05-27 Thread via GitHub


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


##
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:
   Considering future extensibility, it may support other types of time units, 
such as DAY TO HOUR, DAY TO SECOND, which are not directly convertible to 
numeric types, so here it is defined as String type first, which is the widest 
type.
   
   1. https://calcite.apache.org/docs/reference.html



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



Re: [PR] [FLINK-35425][table-common] Support convert freshness to cron expression in full refresh mode [flink]

2024-05-27 Thread via GitHub


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


##
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:
   good point



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



Re: [PR] [FLINK-35425][table-common] Support convert freshness to cron expression in full refresh mode [flink]

2024-05-27 Thread via GitHub


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


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



Re: [PR] [FLINK-35425][table-common] Support convert freshness to cron expression in full refresh mode [flink]

2024-05-27 Thread via GitHub


flinkbot commented on PR #24849:
URL: https://github.com/apache/flink/pull/24849#issuecomment-2133449299

   
   ## CI report:
   
   * 0bd839dee3158adc10d417d271a13f4aa14669e7 UNKNOWN
   
   
   Bot commands
 The @flinkbot bot supports the following commands:
   
- `@flinkbot run azure` re-run the last Azure build
   


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



[PR] [FLINK-35425][table-common] Support convert freshness to cron expression in full refresh mode [flink]

2024-05-27 Thread via GitHub


lsyldliu opened a new pull request, #24849:
URL: https://github.com/apache/flink/pull/24849

   ## What is the purpose of the change
   
   Support convert freshness to cron expression in full refresh mode
   
   
   ## Brief change log
   
 - *Support convert freshness to cron expression in full refresh mode*
   
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
 - *Added unit tests in IntervalFreshnessUtilsTest*
   
   ## Does this pull request potentially affect one of the following parts:
   
 - Dependencies (does it add or upgrade a dependency): (no)
 - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (no)
 - The serializers: (no)
 - The runtime per-record code paths (performance sensitive): (no)
 - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
 - The S3 file system connector: ( no )
   
   ## Documentation
   
 - Does this pull request introduce a new feature? (yes)
 - If yes, how is the feature documented? ( JavaDocs)
   


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