You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "gabeiglio (via GitHub)" <gi...@apache.org> on 2025/08/08 00:56:50 UTC

Re: [PR] Core: Batch load new files when validating replaced partitions [iceberg]

gabeiglio commented on code in PR #13556:
URL: https://github.com/apache/iceberg/pull/13556#discussion_r2261721256


##########
core/src/main/java/org/apache/iceberg/CherryPickOperation.java:
##########
@@ -214,13 +220,17 @@ private static void validateReplacedPartitions(
           parentId == null || isCurrentAncestor(meta, parentId),
           "Cannot cherry-pick overwrite, based on non-ancestor of the current state: %s",
           parentId);
-      List<DataFile> newFiles =
-          SnapshotUtil.newFiles(parentId, meta.currentSnapshot().snapshotId(), meta::snapshot, io);
-      for (DataFile newFile : newFiles) {
-        ValidationException.check(
-            !replacedPartitions.contains(newFile.specId(), newFile.partition()),
-            "Cannot cherry-pick replace partitions with changed partition: %s",
-            newFile.partition());
+      try (CloseableIterable<DataFile> newFiles =
+          SnapshotUtil.newFilesBetween(
+              parentId, meta.currentSnapshot().snapshotId(), meta::snapshot, io)) {
+        for (DataFile newFile : newFiles) {
+          ValidationException.check(
+              !replacedPartitions.contains(newFile.specId(), newFile.partition()),
+              "Cannot cherry-pick replace partitions with changed partition: %s",
+              newFile.partition());
+        }
+      } catch (IOException ioe) {
+        LOG.warn("Failed to close task iterable", ioe);
       }

Review Comment:
   This makes sense, I think for now we can throw an `UncheckedIOException` and say we failed to validate the partitions. 



-- 
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-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org