amogh-jahagirdar commented on code in PR #18074:
URL: https://github.com/apache/iceberg/pull/18074#discussion_r4437493298


##########
core/src/main/java/org/apache/iceberg/BaseTransaction.java:
##########
@@ -455,17 +455,32 @@ private void applyUpdates(TableOperations underlyingOps) {
   }
 
   // returns the manifest lists and manifests referenced by the given 
committed snapshots
-  private static Set<String> committedFiles(FileIO io, Set<Snapshot> 
snapshots) {
+  private Set<String> committedFiles(FileIO io, Set<Snapshot> snapshots) {
     Set<String> committedFiles = Sets.newHashSet();
 
     for (Snapshot snap : snapshots) {
       committedFiles.add(snap.manifestListLocation());
-      snap.allManifests(io).forEach(manifest -> 
committedFiles.add(manifest.path()));
+      committedFiles.addAll(committedManifestPaths(io, snap));
     }
 
     return committedFiles;
   }
 
+  // uses the manifest paths held by the update that wrote the snapshot's 
manifest list, if any
+  private List<String> committedManifestPaths(FileIO io, Snapshot snapshot) {

Review Comment:
   Minor, think the new pattern matching instanceof will help make it a bit 
easier to read:
   
   ```
   private Set<String> committedManifestPaths(FileIO io, Snapshot snapshot) {
     for (PendingUpdate update : updates) {
       if (update instanceof SnapshotProducer<?> producer) {
         Set<String> paths = 
producer.writtenManifestPaths(snapshot.manifestListLocation());
         if (paths != null) {
           return paths;
         }
       }
     }
   
     return 
snapshot.allManifests(io).stream().map(ManifestFile::path).collect(Collectors.toSet());
   }
   ```



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