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


##########
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:
   The code looks the same, but it is not the same transform as it is a 
closure, and `indexes` in the each closure is different, as `indexes` is a 
function of the `SparkDeleteFilter` in each case and that is different.
   I didn't try too hard to avoid the code repetition here, as I didn't feel it 
was worth the effort, but let me think a bit more.



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