JeonDaehong commented on code in PR #18027:
URL: https://github.com/apache/iceberg/pull/18027#discussion_r4005701691
##########
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:
I applied the same idea you suggested for `IsDeletedBuilder` here as well
`RowIdMappingBuilder.accept` is called once per deleted position, so
incrementing there removes this loop entirely rather than making it easier to
read. That means I didn't commit the suggestion literally — let me know if
you'd rather keep an explicit loop.
--
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]