dramaticlly commented on code in PR #10935: URL: https://github.com/apache/iceberg/pull/10935#discussion_r1733659899
########## spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/ChangelogRowReader.java: ########## @@ -112,13 +149,62 @@ private CloseableIterable<InternalRow> openChangelogScanTask(ChangelogScanTask t CloseableIterable<InternalRow> openAddedRowsScanTask(AddedRowsScanTask task) { String filePath = task.file().path().toString(); SparkDeleteFilter deletes = new SparkDeleteFilter(filePath, task.deletes(), counter()); - return deletes.filter(rows(task, deletes.requiredSchema())); + int[] indexes = indexesInRow(deletes.requiredSchema()); + + return CloseableIterable.transform( + deletes.filter(rows(task, deletes.requiredSchema())), + row -> { + InternalRow expectedRow = new GenericInternalRow(columns.length); + + for (int i = 0; i < columns.length; i++) { + expectedRow.update(i, row.get(indexes[i], sparkColumnTypes[i])); + } + + return expectedRow; + }); } private CloseableIterable<InternalRow> openDeletedDataFileScanTask(DeletedDataFileScanTask task) { String filePath = task.file().path().toString(); SparkDeleteFilter deletes = new SparkDeleteFilter(filePath, task.existingDeletes(), counter()); - return deletes.filter(rows(task, deletes.requiredSchema())); + int[] indexes = indexesInRow(deletes.requiredSchema()); + + return CloseableIterable.transform( + deletes.filter(rows(task, deletes.requiredSchema())), + row -> { + InternalRow expectedRow = new GenericInternalRow(columns.length); + + for (int i = 0; i < columns.length; i++) { + expectedRow.update(i, row.get(indexes[i], sparkColumnTypes[i])); + } + + return expectedRow; + }); + } + + private CloseableIterable<InternalRow> openDeletedRowsScanTask(DeletedRowsScanTask task) { + String filePath = task.file().path().toString(); + SparkDeleteFilter existingDeletes = + new SparkDeleteFilter(filePath, task.existingDeletes(), counter()); + SparkDeleteFilter newDeletes = new SparkDeleteFilter(filePath, task.addedDeletes(), counter()); + Schema schema1 = existingDeletes.requiredSchema(); + Schema schema2 = newDeletes.requiredSchema(); + Schema requiredSchema = TypeUtil.join(schema1, schema2); Review Comment: can we inline this to ``` Schema requiredSchema = TypeUtil.join(existingDeletes.requiredSchema(), newDeletes.requiredSchema()); ``` As no other use of schema1 and schema2 below -- 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