wypoon commented on code in PR #4588:
URL: https://github.com/apache/iceberg/pull/4588#discussion_r877629836


##########
core/src/main/java/org/apache/iceberg/deletes/BitmapPositionDeleteIndex.java:
##########
@@ -40,7 +46,11 @@ public void delete(long posStart, long posEnd) {
 
   @Override
   public boolean isDeleted(long position) {
-    return roaring64Bitmap.contains(position);
+    boolean posIsDeleted = roaring64Bitmap.contains(position);
+    if (counter != null && posIsDeleted) {
+      counter.increment();
+    }

Review Comment:
   You are right that one can get the number of deleted positions in the 
`PositionDeleteIndex` by `roaring64Bitmap.getLongCardinality()`.
   However, having one counter keeps the bookkeeping simple and easy to reason 
about.
   There are multiple paths through the code that can be taken, where deletes 
may be applied, and the unifying thing here is that the same counter is passed 
into all these places.
   It is more difficult to reason through the counting if I have to account for 
the `PositionDeleteIndex` cases separately and I would have to keep references 
to the `PositionDeleteIndex` instances (I haven't looked in depth into this). I 
think it would be messy.



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