huaxingao commented on code in PR #11551: URL: https://github.com/apache/iceberg/pull/11551#discussion_r1864760863
########## data/src/main/java/org/apache/iceberg/data/DeleteFilter.java: ########## @@ -73,6 +74,7 @@ protected DeleteFilter( boolean needRowPosCol) { this.filePath = filePath; this.counter = counter; + this.requestedSchema = requestedSchema; Review Comment: Changed to `expectedSchema` ########## spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ColumnarBatchReader.java: ########## @@ -45,11 +45,23 @@ public class ColumnarBatchReader extends BaseBatchReader<ColumnarBatch> { private final boolean hasIsDeletedColumn; private DeleteFilter<InternalRow> deletes = null; private long rowStartPosInBatch = 0; + // In the case of Equality Delete, we have also built ColumnarBatchReader for the equality delete + // filter columns to read the value to find out which rows are deleted. If these deleted filter + // columns are not in the requested schema, then these are the extra columns that we want to + // remove before return the ColumnBatch to Spark. + // Supposed table schema is C1, C2, C3, C4, C5, The query is: + // SELECT C5 FROM table, and the equality delete Filter is on C3, C4, + // We read the values of C3, C4 to figure out which rows are deleted, but we don't want to include + // these values in the ColumnBatch that we return to Spark. In this example, the numOfExtraColumns + // is 2. Since when creating the DeleteFilter, we append these extra columns in the end of the + // requested schema, we can just remove them from the end of the ColumnVector. + private int numOfExtraColumns = 0; - public ColumnarBatchReader(List<VectorizedReader<?>> readers) { + public ColumnarBatchReader(List<VectorizedReader<?>> readers, int numExtraCol) { Review Comment: Changed. Thanks -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org