bryanck commented on code in PR #15396:
URL: https://github.com/apache/iceberg/pull/15396#discussion_r2940889399


##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/SchemaUtils.java:
##########
@@ -126,8 +128,20 @@ private static void commitSchemaUpdates(Table table, 
SchemaUpdate.Consumer updat
         update -> updateSchema.addColumn(update.parentName(), update.name(), 
update.type()));
     updateTypes.forEach(update -> updateSchema.updateColumn(update.name(), 
update.type()));
     makeOptionals.forEach(update -> 
updateSchema.makeColumnOptional(update.name()));
-    updateSchema.commit();
-    LOG.info("Schema for table {} updated with new columns", table.name());
+    try {
+      updateSchema.commit();
+      LOG.info("Schema for table {} updated with new columns", table.name());
+    } catch (ValidationException | CommitFailedException e) {
+      // this can happen if the field already exists in the table, which is 
fine (other task
+      // committed the schema). No action required

Review Comment:
   These exceptions could be caused for other reasons as well, and thus we 
could lose data if we ignore the schema update in those cases.



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