Reo-LEI commented on a change in pull request #3240:
URL: https://github.com/apache/iceberg/pull/3240#discussion_r737421145



##########
File path: 
flink/src/main/java/org/apache/iceberg/flink/source/RowDataFileScanTaskReader.java
##########
@@ -70,9 +71,17 @@ public RowDataFileScanTaskReader(Schema tableSchema, Schema 
projectedSchema,
         PartitionUtil.constantsMap(task, RowDataUtil::convertConstant);
 
     FlinkDeleteFilter deletes = new FlinkDeleteFilter(task, tableSchema, 
projectedSchema, inputFilesDecryptor);
-    return deletes
-        .filter(newIterable(task, deletes.requiredSchema(), idToConstant, 
inputFilesDecryptor))
-        .iterator();
+    CloseableIterable<RowData> iterable = deletes.filter(
+        newIterable(task, deletes.requiredSchema(), idToConstant, 
inputFilesDecryptor)
+    );
+
+    // Project the RowData to remove the extra meta columns.
+    if (!projectedSchema.sameSchema(deletes.requiredSchema())) {
+      RowDataProjection rowDataProjection = 
RowDataProjection.create(deletes.requiredSchema(), projectedSchema);

Review comment:
       Good point! Now I get the row type from `FlinkDeleteFilter` and pass it 
to `RowDataProjection`.

##########
File path: 
flink/src/main/java/org/apache/iceberg/flink/source/RowDataFileScanTaskReader.java
##########
@@ -70,9 +71,17 @@ public RowDataFileScanTaskReader(Schema tableSchema, Schema 
projectedSchema,
         PartitionUtil.constantsMap(task, RowDataUtil::convertConstant);
 
     FlinkDeleteFilter deletes = new FlinkDeleteFilter(task, tableSchema, 
projectedSchema, inputFilesDecryptor);
-    return deletes
-        .filter(newIterable(task, deletes.requiredSchema(), idToConstant, 
inputFilesDecryptor))
-        .iterator();
+    CloseableIterable<RowData> iterable = deletes.filter(
+        newIterable(task, deletes.requiredSchema(), idToConstant, 
inputFilesDecryptor)
+    );
+
+    // Project the RowData to remove the extra meta columns.
+    if (!projectedSchema.sameSchema(deletes.requiredSchema())) {

Review comment:
       I agree with your point, but I don't have idea how to test these cases. 
Currently, The `TestChangeLogTable` can cover the case 2. But how to cover the 
case 1? 
   
   How about adding a precondition to `RowDataProjection` to ensure that 
`schema` and `projectedSchema` are not equal? So that we can ensure the v1 
table will not do any projection when we running the v1 table test.




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