harshilv17 opened a new pull request, #2815:
URL: https://github.com/apache/iceberg-go/pull/2815

   Fixes #2160.
   
   Copy-on-write `Delete` and filtered `Overwrite` read every live delete file 
in the table before removing or rewriting data files, so a small delete on a 
delete-heavy table pays for all of them. This reads only the delete manifests 
that can hold a delete for the affected files, following @badalprasadsingh's 
notes on the issue:
   
   - **Prune by affected files, not the row filter.** The affected files are 
the ones the operation removes or rewrites, including files dropped whole, so 
their deletion vectors are still found. A delete file applies to a data file 
only when both have the same spec and partition, or the delete file's spec is 
unpartitioned ([spec: scan 
planning](https://iceberg.apache.org/spec/#scan-planning)). So a partitioned 
delete manifest is skipped when no affected file has its spec, or when its 
partition summaries rule out every affected partition of that spec.
   - **Always read unpartitioned delete manifests**, since their deletes can 
apply to any partition.
   - **Skip manifests older than every rewritten file.** Every entry has a 
sequence number at most the manifest's, and no delete applies to a data file 
with a higher one. This only applies when no file is dropped whole, because a 
dropped file's sequence number isn't known at that point.
   - **Skip manifests holding only `DELETED` entries**, which were never read 
anyway.
   - **`classifyLiveDeletes` is unchanged**, so merge-on-read still reads every 
delete file and can't miss a DV and write a second one for the same file.
   
   Partitions are matched through the existing manifest evaluator, with one 
filter clause per distinct affected partition. Past `inPredicateLimit` distinct 
partitions, or if the filter can't be built, every manifest of that spec is 
read, as today.
   
   On v3, a merge-on-read delete rewrites the live DVs into one manifest, so 
that manifest spans every partition with a DV and is always read. The pruning 
still applies to position and equality delete manifests and to tables with many 
delete manifests.
   
   ### Tests
   - `TestLiveDeletesForFilesPrunesDeleteManifests`: a v2 table with deletes in 
two partitions reads only the affected partition's manifest, and nothing when 
every delete is older than the files.
   - `TestLiveDeletesForFilesReadsUnpartitionedDeleteManifests`: a delete 
written under the original unpartitioned spec is still read for a file in the 
newer partitioned spec.
   - `TestCopyOnWriteDeleteAppliesDeletesOfRewrittenPartition`: an end-to-end 
copy-on-write delete on v2 and v3 still drops rows removed by earlier 
merge-on-read deletes.
   
   `go test ./table/...` and `go vet` pass.


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