Guosmilesmile commented on code in PR #18149:
URL: https://github.com/apache/iceberg/pull/18149#discussion_r4595127206


##########
flink/v2.3/flink/src/test/java/org/apache/iceberg/flink/source/TestIcebergLookupJoinSql.java:
##########
@@ -288,8 +395,34 @@ private void createDimTable(Record... records) throws 
IOException {
     helper.appendToTable(dataFile);
   }
 
+  private static void createRepeatingOrdersTable(
+      TableEnvironment tableEnvironment, String tableName, int numberOfKeys) {
+    SqlHelpers.sql(
+        tableEnvironment,
+        "CREATE TEMPORARY TABLE %s (\n"
+            + "  user_id  BIGINT,\n"
+            + "  proc_time AS PROCTIME()\n"
+            + ") WITH (\n"
+            + "  'connector' = 'datagen',\n"
+            + "  'fields.user_id.kind' = 'random',\n"
+            + "  'fields.user_id.min' = '1',\n"
+            + "  'fields.user_id.max' = '%d',\n"
+            + "  'rows-per-second' = '50'\n"
+            + ")",
+        tableName,
+        numberOfKeys);
+  }
+
   private static void createOrdersTable(
       TableEnvironment tableEnvironment, String tableName, int numberOfRows) {
+    createOrdersTable(tableEnvironment, tableName, numberOfRows, "");
+  }
+
+  private static void createOrdersTable(
+      TableEnvironment tableEnvironment,
+      String tableName,
+      int numberOfRows,
+      String additionalOptions) {

Review Comment:
   You are right . Remove it . 



##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/source/lookup/FullCacheReloadTriggerFactory.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.iceberg.flink.source.lookup;
+
+import javax.annotation.Nullable;
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.table.connector.source.lookup.LookupOptions;
+import 
org.apache.flink.table.connector.source.lookup.LookupOptions.LookupCacheType;
+import 
org.apache.flink.table.connector.source.lookup.cache.trigger.CacheReloadTrigger;
+import 
org.apache.flink.table.connector.source.lookup.cache.trigger.PeriodicCacheReloadTrigger;
+import 
org.apache.flink.table.connector.source.lookup.cache.trigger.TimedCacheReloadTrigger;
+
+@Internal
+public class FullCacheReloadTriggerFactory {
+
+  public static @Nullable CacheReloadTrigger create(Configuration lookupConf) {
+    if (!lookupConf.contains(LookupOptions.FULL_CACHE_RELOAD_STRATEGY)) {

Review Comment:
   I agree we shouldn't merge these options because they are standard Flink 
`LookupOptions`. Merging them would require us to parse the configuration 
ourselves instead of reusing Flink's `fromConfig` methods.
   
   I handled two cases:
   
   1. Missing reload-strategy: If other `lookup.full-cache.*` options are 
configured but `reload-strategy` is not set, the factory logs a WARN listing 
the ignored options and explaining that the cache won't be reloaded. Existing 
behavior remains unchanged, so current jobs are not affected.
   
   2. Missing required values: For example, `PERIODIC` without 
`periodic-reload.interval`, or `TIMED` without `timed-reload.iso-time`. Flink 
already reports these errors, so no extra handling is needed.



##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/source/lookup/IcebergFullCachingLookupFunction.java:
##########
@@ -181,22 +245,32 @@ private void loadCache() throws IOException {
     long start = System.currentTimeMillis();
     try (CloseableIterable<RowData> rows = reader.read(snapshotId)) {
       for (RowData row : rows) {
+        if (closed) {
+          return;
+        }
+
         loaded.add(extractKey(row), rowSerializer.toBinaryRow(row).copy());

Review Comment:
   Good suggestion, add a new rowSerializer to avoid reuse.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to