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


##########
spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ColumnarBatchUtil.java:
##########
@@ -83,6 +91,27 @@ public static Pair<int[], Integer> buildRowIdMapping(
     return liveRowId == batchSize ? null : Pair.of(rowIdMapping, liveRowId);
   }
 
+  // builds the mapping from the deleted positions in the batch range, without 
probing per row
+  private static Pair<int[], Integer> buildRowIdMapping(
+      PositionDeleteIndex deletedPositions,
+      DeleteFilter<InternalRow> deletes,
+      long rowStartPosInBatch,
+      int batchSize) {
+    RowIdMappingBuilder builder = new RowIdMappingBuilder(rowStartPosInBatch, 
batchSize);
+    deletedPositions.forEachInRange(rowStartPosInBatch, batchSize, builder);
+    int liveRowId = builder.build();
+
+    if (liveRowId == batchSize) {
+      return null;
+    }
+
+    for (int index = liveRowId; index < batchSize; index++) {
+      deletes.incrementDeleteCount();
+    }

Review Comment:
   This is a bit tricky to read. Is this more clear? Optimizer will fix it 
anyways.
   ```suggestion
      int deletedRowCount = batchSize - liveRowId;
      for (int i = 0; i < deletedRowCount; i++) {
        deletes.incrementDeleteCount();
      }
   ```



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