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


##########
spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ColumnarBatchUtil.java:
##########
@@ -178,4 +217,68 @@ 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 {
+    private final long rowStartPosInBatch;
+    private final int batchSize;
+    private final int[] rowIdMapping;
+    private int nextRowId = 0;
+    private int liveRowId = 0;
+
+    RowIdMappingBuilder(long rowStartPosInBatch, int batchSize) {
+      this.rowStartPosInBatch = rowStartPosInBatch;
+      this.batchSize = batchSize;
+      this.rowIdMapping = new int[batchSize];
+    }
+
+    @Override
+    public void accept(long pos) {
+      int deletedRowId = (int) (pos - rowStartPosInBatch);
+      for (int rowId = nextRowId; rowId < deletedRowId; rowId++) {
+        rowIdMapping[liveRowId] = rowId;
+        liveRowId++;
+      }
+
+      this.nextRowId = deletedRowId + 1;
+    }
+
+    /** Appends the live rows after the last deleted position and returns the 
live row count. */
+    int build() {

Review Comment:
   this is not a `build` method.



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