twuebi commented on code in PR #1296:
URL: https://github.com/apache/iceberg-go/pull/1296#discussion_r3467820583


##########
table/compaction/compaction.go:
##########
@@ -279,3 +315,31 @@ func (cfg Config) isCandidate(t table.FileScanTask) bool {
        // Undersized — candidate.
        return true
 }
+
+// fileScopedDeletedRows sums the record counts of the task's file-scoped
+// deletes — deletion vectors and path-scoped positional deletes. These apply
+// to exactly one data file, so their counts are attributable to it. The sum is
+// not capped here; callers cap at the data file's record count.
+func fileScopedDeletedRows(t table.FileScanTask) int64 {
+       var deleted int64
+       for _, d := range t.DeletionVectorFiles {
+               if isFileScoped(d) {
+                       deleted += d.Count()
+               }
+       }
+       for _, d := range t.DeleteFiles {
+               if isFileScoped(d) {
+                       deleted += d.Count()
+               }
+       }
+
+       return deleted
+}
+
+// isFileScoped reports whether a delete file applies to exactly one data file.
+// Mirrors Java ContentFileUtil.isFileScoped: deletion vectors and path-scoped
+// positional deletes carry a referenced data file; partition-scoped positional
+// deletes and equality deletes do not.
+func isFileScoped(d iceberg.DataFile) bool {

Review Comment:
   done, added the eq delete short circuit and equal file path fallback & added 
a test exercising the fallback



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