Skip to content

Commit 29d1c09

Browse files
authored
Merge branch 'JanKaul:main' into main
2 parents 97c99fa + 31d6d91 commit 29d1c09

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

iceberg-rust/src/catalog/commit.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,10 @@ pub fn apply_table_updates(
513513
for id in snapshot_ids {
514514
metadata.snapshots.remove(&id);
515515
}
516+
517+
metadata
518+
.snapshot_log
519+
.retain(|e| metadata.snapshots.contains_key(&e.snapshot_id));
516520
}
517521
TableUpdate::RemoveSnapshotRef { ref_name } => {
518522
metadata.refs.remove(&ref_name);

iceberg-rust/src/table/manifest.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,12 @@ impl<'schema, 'metadata> ManifestWriter<'schema, 'metadata> {
386386
manifest.existing_files_count = Some(
387387
manifest.existing_files_count.unwrap_or(0) + manifest.added_files_count.unwrap_or(0),
388388
);
389+
manifest.existing_rows_count = Some(
390+
manifest.existing_rows_count.unwrap_or(0) + manifest.added_rows_count.unwrap_or(0),
391+
);
389392

390393
manifest.added_files_count = None;
394+
manifest.added_rows_count = None;
391395

392396
Ok(ManifestWriter {
393397
manifest,
@@ -525,10 +529,16 @@ impl<'schema, 'metadata> ManifestWriter<'schema, 'metadata> {
525529
manifest.sequence_number = table_metadata.last_sequence_number + 1;
526530

527531
manifest.existing_files_count = Some(
528-
manifest.existing_files_count.unwrap_or(0) + manifest.added_files_count.unwrap_or(0),
532+
manifest.existing_files_count.unwrap_or(0) + manifest.added_files_count.unwrap_or(0)
533+
- filtered_stats.removed_data_files,
534+
);
535+
manifest.existing_rows_count = Some(
536+
manifest.existing_rows_count.unwrap_or(0) + manifest.added_rows_count.unwrap_or(0)
537+
- filtered_stats.removed_records,
529538
);
530539

531540
manifest.added_files_count = None;
541+
manifest.added_rows_count = None;
532542

533543
Ok((
534544
ManifestWriter {

0 commit comments

Comments
 (0)