RussellSpitzer commented on code in PR #4888:
URL: https://github.com/apache/iceberg/pull/4888#discussion_r898097104


##########
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ColumnarBatchReader.java:
##########
@@ -72,31 +84,44 @@ public final ColumnarBatch read(ColumnarBatch reuse, int 
numRowsToRead) {
   }
 
   private class ColumnBatchLoader {
-    private int[] rowIdMapping; // the rowId mapping to skip deleted rows for 
all column vectors inside a batch
-    private int numRows;
     private ColumnarBatch columnarBatch;
+    private final int numRowsToRead;
+    private int[] rowIdMapping; // the rowId mapping to skip deleted rows for 
all column vectors inside a batch
+    private boolean[] isDeleted; // the array to indicate if a row is deleted 
or not
 
     ColumnBatchLoader(int numRowsToRead) {
-      initRowIdMapping(numRowsToRead);
-      loadDataToColumnBatch(numRowsToRead);
+      Preconditions.checkArgument(numRowsToRead > 0, "Invalid number of rows 
to read: %s", numRowsToRead);
+      this.numRowsToRead = numRowsToRead;
+      this.columnarBatch = loadDataToColumnBatch();
     }
 
-    ColumnarBatch loadDataToColumnBatch(int numRowsToRead) {
-      Preconditions.checkArgument(numRowsToRead > 0, "Invalid number of rows 
to read: %s", numRowsToRead);
-      ColumnVector[] arrowColumnVectors = 
readDataToColumnVectors(numRowsToRead);
+    ColumnarBatch loadDataToColumnBatch() {
+      int numRowsUndeleted = initRowIdMapping();
+
+      ColumnVector[] arrowColumnVectors = readDataToColumnVectors();
 
-      columnarBatch = new ColumnarBatch(arrowColumnVectors);
-      columnarBatch.setNumRows(numRows);
+      ColumnarBatch newColumnarBatch = new ColumnarBatch(arrowColumnVectors);
+      newColumnarBatch.setNumRows(numRowsUndeleted);
 
       if (hasEqDeletes()) {
-        applyEqDelete();
+        numRowsUndeleted = applyEqDelete(newColumnarBatch);
+      }
+
+      if (hasColumnIsDeleted) {

Review Comment:
   This is a nit but, i think this makes more sense read a `hasIsDeletedColumn`



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