amogh-jahagirdar commented on code in PR #2667:
URL: https://github.com/apache/iceberg-rust/pull/2667#discussion_r3462242769


##########
crates/iceberg/src/transaction/expire_snapshots.rs:
##########
@@ -321,6 +321,26 @@ impl TransactionAction for ExpireSnapshotsAction {
             .into_iter()
             .map(|ref_name| TableUpdate::RemoveSnapshotRef { ref_name })
             .collect();
+
+        // Drop the statistics metadata tied to each expired snapshot, 
mirroring Java
+        // `RemoveSnapshots.removeSnapshots`. This only rewrites metadata; the 
puffin files those
+        // entries point at are deleted by the higher-level file-cleanup 
maintenance operation.
+        for snapshot_id in &plan.ids_to_remove {

Review Comment:
   Minor: I think the following is a more idiomatic way:
   ```
   for &snapshot_id in &plan.ids_to_remove {
       updates.extend(
           metadata
               .statistics_for_snapshot(snapshot_id)
               .is_some()
               .then_some(TableUpdate::RemoveStatistics { snapshot_id }),
       );
   
       updates.extend(
           metadata
               .partition_statistics_for_snapshot(snapshot_id)
               .is_some()
               .then_some(TableUpdate::RemovePartitionStatistics { snapshot_id 
}),
       );
   }
   
   ```



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