CTTY opened a new issue, #3832:
URL: https://github.com/apache/iceberg-rust/issues/3832

   ### Apache Iceberg Rust version
   
   main (`f38775a8`)
   
   ### Describe the bug
   
   `SnapshotSummaryCollector` (`crates/iceberg/src/spec/snapshot_summary.rs`) 
treats a deletion vector like any other delete file:
   
   - `UpdateMetrics::add_file` / `remove_file` add 
`data_file.file_size_in_bytes` to `added-files-size` / `removed-files-size` 
(lines 196, 216). For a DV that is the size of the whole Puffin file, so a 
commit that adds three DVs stored in one Puffin file counts that file's size 
three times.
   - A DV is counted in `added-position-delete-files` / 
`removed-position-delete-files` (lines 204, 224) and there are no `added-dvs` / 
`removed-dvs` properties.
   
   Java's `SnapshotSummary.UpdateMetrics` sizes a file with 
`ScanTaskUtil.contentSizeInBytes(file)`, which returns `content_size_in_bytes` 
for a DV and `file_size_in_bytes` otherwise, and increments `addedDVs` / 
`removedDVs` (`ADDED_DVS_PROP = "added-dvs"`, `REMOVED_DVS_PROP = 
"removed-dvs"`) when `ContentFileUtil.isDV(file)`. DVs still count toward the 
overall delete file and position delete record totals.
   
   Today nothing in this crate adds a DV to a snapshot 
(`SimpleSnapshotProducer` only appends data files), so the difference is not 
observable. #3564 adds `MergingSnapshotProducer`, which adds and removes delete 
files including DVs, so its summaries will carry the inflated sizes. Fixing it 
belongs in `snapshot_summary.rs` rather than in that PR.
   
   ### To Reproduce
   
   Build a `DataFile` with `content: PositionDeletes`, `file_format: Puffin`, 
`file_size_in_bytes: 1000`, `content_offset: Some(4)`, `content_size_in_bytes: 
Some(10)`, and a second one in the same path at another offset. 
`collector.add_file(...)` both and `collector.build()`:
   
   - `added-files-size` is `2000`; Java reports `20`.
   - `added-position-delete-files` is `2` and there is no `added-dvs`; Java 
reports `added-dvs = 2` as well.
   
   ### Expected behavior
   
   Match Java:
   
   - size a DV by `content_size_in_bytes`, other files by `file_size_in_bytes`, 
in both the global and the per-partition metrics;
   - add `added-dvs` / `removed-dvs`, counting a file that is `PositionDeletes` 
with `file_format == Puffin`;
   - keep DVs in `added-delete-files` / `removed-delete-files` and in the 
position delete record counts.
   
   ### Willingness to contribute
   
   - [x] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg Rust community
   - [ ] I cannot contribute a fix for this bug at this time
   


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