openinx commented on a change in pull request #3991:
URL: https://github.com/apache/iceberg/pull/3991#discussion_r839156172
##########
File path:
flink/v1.14/flink/src/main/java/org/apache/iceberg/flink/source/RowDataFileScanTaskReader.java
##########
@@ -77,9 +85,19 @@ public RowDataFileScanTaskReader(Schema tableSchema, Schema
projectedSchema,
);
// Project the RowData to remove the extra meta columns.
- if (!projectedSchema.sameSchema(deletes.requiredSchema())) {
- RowDataProjection rowDataProjection = RowDataProjection.create(
- deletes.requiredRowType(), deletes.requiredSchema().asStruct(),
projectedSchema.asStruct());
+ if (!projectedSchema.sameSchema(deletes.requiredSchema()) &&
projectedFields == null) {
+ Map<Integer, Integer> fieldIdToPosition =
Maps.newHashMapWithExpectedSize(tableSchema.asStruct().fields().size());
+ for (int i = 0; i < tableSchema.asStruct().fields().size(); i++) {
+
fieldIdToPosition.put(tableSchema.asStruct().fields().get(i).fieldId(), i);
+ }
+ projectedFields = projectedSchema.columns().stream()
+ .map(field -> new int[] {fieldIdToPosition.get(field.fieldId())})
+ .toArray(int[][]::new);
+ }
+
+ if (projectedFields != null) {
+ RowDataProjection rowDataProjection =
RowDataProjection.create(tableSchema, projectedSchema,
+ projectedFields);
Review comment:
Those changes are not required in my thought, according to my above
comment.
--
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]