JeonDaehong commented on code in PR #18027:
URL: https://github.com/apache/iceberg/pull/18027#discussion_r4005526662


##########
core/src/main/java/org/apache/iceberg/deletes/PositionDeleteIndex.java:
##########
@@ -79,6 +79,28 @@ default void forEach(LongConsumer consumer) {
     }
   }
 
+  /**
+   * Traverses the deleted positions within the given range in ascending 
order, applying the
+   * provided consumer.
+   *
+   * <p>Callers that test a contiguous range of positions should prefer this 
method over calling
+   * {@link #isDeleted(long)} once per position. Implementations backed by a 
bitmap can locate the
+   * containers covering the range once and walk them, instead of resolving 
the container for every
+   * position.
+   *
+   * @param posStart the first position in the range, inclusive
+   * @param length the number of positions in the range
+   * @param consumer a consumer for the deleted positions in the range
+   */
+  default void forEachInRange(long posStart, int length, LongConsumer 
consumer) {

Review Comment:
   Done, and thanks for catching it — this turned out to be more than just a 
rename.
   
   The old implementation relied on `length` being an `int` to guarantee a 
range spans at most two 32-bit keys, and the comment said so explicitly. With a 
`long` end that no longer holds, so the per-key loop is now general, and the 
inner traversal chunks any sub-range wider than `Integer.MAX_VALUE` 
(`RoaringPositionBitmap.forEachInRange` takes an int length, so a fully covered 
middle bitmap cannot be expressed in one call).
   
   `RoaringPositionBitmap.forEachInRange` now follows `setRange` for parameter 
names, for the precondition, and for treating an empty range as a no-op, so the 
two read the same way. Added a test for a range spanning three keys, which is 
the path that did not exist before.



##########
core/src/main/java/org/apache/iceberg/deletes/PositionDeleteIndex.java:
##########
@@ -79,6 +79,28 @@ default void forEach(LongConsumer consumer) {
     }
   }
 
+  /**
+   * Traverses the deleted positions within the given range in ascending 
order, applying the
+   * provided consumer.
+   *
+   * <p>Callers that test a contiguous range of positions should prefer this 
method over calling
+   * {@link #isDeleted(long)} once per position. Implementations backed by a 
bitmap can locate the
+   * containers covering the range once and walk them, instead of resolving 
the container for every
+   * position.
+   *
+   * @param posStart the first position in the range, inclusive
+   * @param length the number of positions in the range
+   * @param consumer a consumer for the deleted positions in the range
+   */
+  default void forEachInRange(long posStart, int length, LongConsumer 
consumer) {

Review Comment:
   Done, and thanks for catching it... this turned out to be more than just a 
rename.
   
   The old implementation relied on `length` being an `int` to guarantee a 
range spans at most two 32-bit keys, and the comment said so explicitly. With a 
`long` end that no longer holds, so the per-key loop is now general, and the 
inner traversal chunks any sub-range wider than `Integer.MAX_VALUE` 
(`RoaringPositionBitmap.forEachInRange` takes an int length, so a fully covered 
middle bitmap cannot be expressed in one call).
   
   `RoaringPositionBitmap.forEachInRange` now follows `setRange` for parameter 
names, for the precondition, and for treating an empty range as a no-op, so the 
two read the same way. Added a test for a range spanning three keys, which is 
the path that did not exist before.



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