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