mxm commented on code in PR #13883:
URL: https://github.com/apache/iceberg/pull/13883#discussion_r2297476033


##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableUpdater.java:
##########
@@ -90,6 +109,53 @@ private void findOrCreateTable(TableIdentifier identifier, 
Schema schema, Partit
     }
   }
 
+  private void updateTablePropertiesIfNeeded(TableIdentifier identifier) {
+    if (tablePropertiesUpdater == null) {
+      return;
+    }
+
+    Map<String, String> currentProperties = cache.properties(identifier);
+    Map<String, String> updatedProperties =
+        tablePropertiesUpdater.apply(identifier.toString(), currentProperties);
+
+    if (updatedProperties == null || Objects.equals(currentProperties, 
updatedProperties)) {
+      return;
+    }
+
+    LOG.info(
+        "Updating table {} properties from {} to {}",
+        identifier,
+        currentProperties,
+        updatedProperties);
+    Table table = catalog.loadTable(identifier);
+    try {
+      UpdateProperties updateApi = table.updateProperties();
+
+      // Remove properties that are no longer present

Review Comment:
   I'm not 100% sure though how the "needsUpdate()" method will make a 
difference. If the user returns the same properties, we will already skip the 
update. Concerning the time of the update, I think properties will have to be 
updated on first seeing the table (that is, if there are changes to the 
properties). Not sure if there is a way around it.



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