dhruvarya-db commented on code in PR #2667:
URL: https://github.com/apache/iceberg-rust/pull/2667#discussion_r3463242527
##########
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 {
+ if metadata.statistics_for_snapshot(*snapshot_id).is_some() {
+ updates.push(TableUpdate::RemoveStatistics {
+ snapshot_id: *snapshot_id,
+ });
+ }
+ if metadata
+ .partition_statistics_for_snapshot(*snapshot_id)
+ .is_some()
+ {
+ updates.push(TableUpdate::RemovePartitionStatistics {
+ snapshot_id: *snapshot_id,
+ });
+ }
+ }
Review Comment:
Done in 184ea96 — the stats removals are now appended after the
`RemoveSnapshots` push, so the sequence reads refs -> snapshots -> stats. Built
the stats updates into a temp vec first (to read the ids before they're moved
into `RemoveSnapshots`) then extend afterwards, so no clone.
##########
crates/iceberg/src/transaction/expire_snapshots.rs:
##########
@@ -472,6 +493,69 @@ mod tests {
base.with_metadata(Arc::new(builder.build().unwrap().metadata))
}
+ /// Like [`table_with`], but also attaches statistics and
partition-statistics files.
+ fn table_with_stats(
Review Comment:
Done in 184ea96 — `table_with_stats` now calls `table_with` for the
snapshot/ref wiring and just layers stats on top, so the two can't drift.
--
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]