dramaticlly commented on code in PR #16336:
URL: https://github.com/apache/iceberg/pull/16336#discussion_r3291144608


##########
core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java:
##########
@@ -179,6 +180,7 @@ public List<ManifestFile> apply(TableMetadata base, 
Snapshot snapshot) {
       keepActiveManifests(currentManifests);
     }
 
+    prepareRewrittenAddedManifests();

Review Comment:
   can probably inline like 
https://github.com/apache/iceberg/blob/fca74a08c6e0a08646647dcbda9a63fe90ee88d5/core/src/main/java/org/apache/iceberg/SnapshotProducer.java#L301-L305
   ```suggestion
     if (rewrittenAddedManifests.isEmpty() && !pendingAddedManifests.isEmpty()) 
{                                                                               
                                                                                
                                                                                
                                                                                
                                
       ManifestFile[] copied = new ManifestFile[pendingAddedManifests.size()];  
                                                                                
                                                                                
                                                                                
                                                                                
                                
       Tasks.range(copied.length)                                               
                                                                                
                                                                                
                                                                                
                                                                                
  
           .stopOnFailure()
           .throwFailureWhenFinished()
           .executeWith(workerPool())                                           
                                                                                
                                                                                
                                                                                
                                                                                
                          
           .run(index -> copied[index] = 
copyManifest(pendingAddedManifests.get(index)));                                
                                                                                
                                                                                
                                                                                
                                                                       
       Collections.addAll(rewrittenAddedManifests, copied);                     
                                                                                
                                                                                
                                                                                
                                                                                
                          
     }                                                     
   ```



##########
core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java:
##########
@@ -54,6 +54,7 @@ public class BaseRewriteManifests extends 
SnapshotProducer<RewriteManifests>
 
   private final Set<ManifestFile> deletedManifests = Sets.newHashSet();
   private final List<ManifestFile> addedManifests = Lists.newArrayList();
+  private final List<ManifestFile> pendingAddedManifests = 
Lists.newArrayList();

Review Comment:
   the `summary()` still check for size of rewrittenAddedManifests after the 
rewrite/apply so the intermediate change is correctly accounted for.



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