danny0405 commented on a change in pull request #13763:
URL: https://github.com/apache/flink/pull/13763#discussion_r511757745



##########
File path: 
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java
##########
@@ -362,7 +369,11 @@ public static Schema convertToSchema(LogicalType 
logicalType, String rowName) {
                                        .record(rowName)
                                        .fields();
                                for (int i = 0; i < rowType.getFieldCount(); 
i++) {
-                                       String fieldName = rowName + "_" + 
fieldNames.get(i);
+                                       String fieldName = fieldNames.get(i);
+                                       if (rowName.equals(fieldName)) {
+                                               // Can not build schema when 
the record and field have the same name
+                                               fieldName = rowName + "_" + 
fieldName;
+                                       }

Review comment:
       Yes, the avro schema builder does not allow same name field names, even 
if they are in different scope (different layer).




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to