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


##########
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:
   nit: rename, as it is not a Builder anymore



##########
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 {
+    private final DeleteFilter<InternalRow> deletes;
+    private final long rowStartPosInBatch;
+    private final int batchSize;
+    private final int[] rowIdMapping;
+    private int nextRowId = 0;
+    private int liveRowId = 0;
+
+    RowIdMappingBuilder(DeleteFilter<InternalRow> deletes, long 
rowStartPosInBatch, int batchSize) {
+      this.deletes = deletes;
+      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++;
+      }
+
+      deletes.incrementDeleteCount();
+      this.nextRowId = deletedRowId + 1;
+    }
+
+    /** Appends the live rows that follow the last deleted position in the 
batch. */
+    void appendRemainingLiveRows() {
+      for (int rowId = nextRowId; rowId < batchSize; rowId++) {
+        rowIdMapping[liveRowId] = rowId;
+        liveRowId++;
+      }
+    }
+
+    int liveRowCount() {
+      return liveRowId;
+    }
+
+    int[] rowIdMapping() {
+      return rowIdMapping;
+    }
+  }
+
+  /** Consumes deleted positions in a batch range, marking them in the given 
array. */
+  private static class IsDeletedBuilder implements LongConsumer {

Review Comment:
   nit: rename, as it is not a Builder anymore



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