pvary commented on code in PR #15329:
URL: https://github.com/apache/iceberg/pull/15329#discussion_r2814347457


##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkSchemaVisitor.java:
##########
@@ -94,24 +96,29 @@ private static <T> T visitRecord(
     List<LogicalType> fieldTypes = 
Lists.newArrayListWithExpectedSize(fieldSize);
     List<Types.NestedField> nestedFields = struct.fields();
 
-    for (int i = 0; i < fieldSize; i++) {
-      Types.NestedField iField = nestedFields.get(i);
-      int fieldIndex = rowType.getFieldIndex(iField.name());
-      Preconditions.checkArgument(
-          fieldIndex >= 0, "NestedField: %s is not found in flink RowType: 
%s", iField, rowType);
+    visitor.beforeStruct(struct.asStructType());
 
-      LogicalType fieldFlinkType = rowType.getTypeAt(fieldIndex);
+    try {

Review Comment:
   We have the same pattern for every field, that the `after` method is called 
in the `finally`. Since I have added the `afterStruct`, I have decided to 
follow the same pattern here as well.



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