rdblue commented on a change in pull request #3104: URL: https://github.com/apache/iceberg/pull/3104#discussion_r780846388
########## File path: core/src/main/java/org/apache/iceberg/TableMetadata.java ########## @@ -502,7 +519,10 @@ public TableMetadata replaceCurrentSnapshot(Snapshot snapshot) { } public TableMetadata removeSnapshotsIf(Predicate<Snapshot> removeIf) { - List<Snapshot> toRemove = snapshots.stream().filter(removeIf).collect(Collectors.toList()); + List<Snapshot> toRemove = snapshots.stream() + .filter(removeIf) + .filter(snapshot -> !refsById.containsKey(snapshot.snapshotId())) + .collect(Collectors.toList()); Review comment: I think it is probably time to remove this method, or at least to stop using it. Instead, I'd probably just produce a list of snapshot IDs to remove. That fits better with the new builder style. -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org