szehon-ho commented on code in PR #3457:
URL: https://github.com/apache/iceberg/pull/3457#discussion_r933684634
##########
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -171,11 +173,15 @@ public Dataset<Row> expire() {
expireSnapshots.commit();
- // fetch metadata after expiration
- Dataset<Row> validFiles = buildValidFileDF(ops.refresh());
+ TableMetadata updatedTable = ops.refresh();
+ Set<Long> retainedSnapshots =
+
updatedTable.snapshots().stream().map(Snapshot::snapshotId).collect(Collectors.toSet());
+ Dataset<Row> validFiles = buildValidFileDF(updatedTable);
+ Dataset<Row> deleteCandidateFiles =
Review Comment:
Sure, it makes sense to me, can make the change.
I had the optimization in the end to pass the lesser of the two sets to
Spark , with either 'in' or 'not in', but can still do it the other way.
--
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]