gengliangwang opened a new pull request, #3841:
URL: https://github.com/apache/iceberg-rust/pull/3841

   ## Which issue does this PR close?
   
   - Closes #3838.
   
   ## What changes are included in this PR?
   
   `SnapshotSummaryCollector::add_file` and `remove_file` skipped the 
per-partition metrics for a file whose partition tuple is empty. A snapshot of 
an unpartitioned table had no `changed-partition-count`, and a snapshot that 
changed files of an unpartitioned spec next to files of a partitioned one 
counted one partition too few.
   
   Both now update the partition metrics for every file, as Java's 
`SnapshotSummary.Builder.updatePartitions` does: a file of an unpartitioned 
spec belongs to the empty partition path, so such a snapshot reports 
`changed-partition-count = 1`. The empty path gets no `partitions.` entry of 
its own when partition summaries are enabled, which is also what Java does 
(`SnapshotSummary.Builder.build` skips an empty key).
   
   Two existing tests (`test_snapshot_summary_collector_build` and 
`test_snapshot_summary_collector_merge`) passed files with an empty partition 
tuple together with a partitioned spec, which only worked because of the 
removed check. Their files now carry a value for the spec's field.
   
   ## Are these changes tested?
   
   - `test_snapshot_summary_collector_counts_unpartitioned_files` adds and 
removes files of an unpartitioned spec and checks `changed-partition-count`, 
and that no `partitions.` entry is written for them within the summary limit. 
It fails on main.
   - `test_snapshot_summary_collector_build` now also checks the count for a 
partitioned table.
   
   ## AI Disclosure
   
   The code, the tests and this description were drafted with an AI coding 
assistant. I reviewed them and ran the tests locally.
   
   This pull request and its description were written by Isaac.
   


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