vaultah commented on code in PR #13720:
URL: https://github.com/apache/iceberg/pull/13720#discussion_r2292261550


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteTablePathSparkAction.java:
##########
@@ -281,24 +281,32 @@ private String rebuildMetadata() {
     // rebuild version files
     RewriteResult<Snapshot> rewriteVersionResult = 
rewriteVersionFiles(endMetadata);
     Set<Snapshot> deltaSnapshots = deltaSnapshots(startMetadata, 
rewriteVersionResult.toRewrite());
-
-    Set<String> manifestsToRewrite = manifestsToRewrite(deltaSnapshots, 
startMetadata);
     Set<Snapshot> validSnapshots =
         Sets.difference(snapshotSet(endMetadata), snapshotSet(startMetadata));
 
+    // rebuild manifest files
+    Set<ManifestFile> manifestsToRewrite = manifestsToRewrite(validSnapshots);

Review Comment:
   `deltaSnapshots` and `validSnapshots` are different:
   
    - `deltaSnapshots` has the full history of snapshots between `startVersion` 
and `endVersion` including expired snapshots. It's later used to filter entries 
within manifests (see `snapshotIds` argument to 
`RewriteTablePathUtil.rewriteDataManifest` and 
`RewriteTablePathUtil.rewriteDeleteManifest`).
   
    - `validSnapshots` are the current live snapshots between `startVersion` 
and `endVersion`. These are the only snapshots we rewrite, so we only need to 
rewrite manifests referenced in those snapshots. Still, we need to rewrite all 
the referenced manifests so all sizes in manifest lists are correct.



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