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


##########
core/src/main/java/org/apache/iceberg/deletes/RoaringPositionBitmap.java:
##########
@@ -192,6 +193,43 @@ public void forEach(LongConsumer consumer) {
     }
   }
 
+  /**
+   * Iterates over the positions set within the given range, in ascending 
order.
+   *
+   * <p>Each underlying 32-bit bitmap that the range covers is traversed once, 
instead of resolving
+   * the containing bitmap for every position as {@link #contains(long)} does.
+   *
+   * @param posStartInclusive inclusive beginning of position range
+   * @param posEndExclusive exclusive ending of position range
+   * @param consumer a consumer for the positions that are set within the range
+   */
+  public void forEachInRange(long posStartInclusive, long posEndExclusive, 
LongConsumer consumer) {
+    Preconditions.checkArgument(
+        posStartInclusive <= posEndExclusive,
+        "Start position must not exceed end position: [%s, %s)",
+        posStartInclusive,
+        posEndExclusive);
+
+    if (posStartInclusive == posEndExclusive) {
+      return;
+    }
+
+    validatePosition(posStartInclusive);
+    validatePosition(posEndExclusive - 1);
+
+    int startKey = key(posStartInclusive);
+    int endKey = key(posEndExclusive - 1);
+
+    for (int key = startKey; key <= endKey && key < bitmaps.length; key++) {
+      long lowStart = key == startKey ? 
Integer.toUnsignedLong(pos32Bits(posStartInclusive)) : 0L;
+      long lowEnd =
+          key == endKey
+              ? Integer.toUnsignedLong(pos32Bits(posEndExclusive - 1)) + 1
+              : MAX_POS_32_BITS + 1;

Review Comment:
   Switched to 1L << 32 to keep it consistent, and removed the now-unused 
MAX_POS_32_BITS



##########
spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ColumnarBatchUtil.java:
##########
@@ -178,4 +207,71 @@ public static ColumnVector[] removeExtraColumns(
       return columnVectors;
     }
   }
+
+  /**
+   * Consumes deleted positions in ascending order, filling the gaps between 
them with live row IDs.
+   */
+  private static class RowIdMappingBuilder implements LongConsumer {

Review Comment:
   Done. Renamed to `RowIdMappingCollector.`



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