wypoon commented on code in PR #10935:
URL: https://github.com/apache/iceberg/pull/10935#discussion_r1726387609


##########
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;
+        });

Review Comment:
   When `DeleteFilter::filter` is called, if there are deletes to be applied, 
the `requiredSchema` could have additional columns beyond the requested schema 
(e.g., `_pos` is added if there are positional deletes to be applied). Thus the 
`InternalRow` could have more columns than the requested schema, and we need to 
exclude the additional columns and only keep the ones for the requested schema.



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

Reply via email to