twalthr commented on a change in pull request #10503: [FLINK-15137][avro] 
Improve schema derivation for Avro format
URL: https://github.com/apache/flink/pull/10503#discussion_r359212649
 
 

 ##########
 File path: 
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroRowDeserializationSchema.java
 ##########
 @@ -196,19 +225,21 @@ public int hashCode() {
 
        // 
--------------------------------------------------------------------------------------------
 
-       private Row convertAvroRecordToRow(Schema schema, RowTypeInfo typeInfo, 
IndexedRecord record) {
+       private Row convertAvroRecordToRow(Schema schema, RowType rowType, 
IndexedRecord record) {
                final List<Schema.Field> fields = schema.getFields();
-               final TypeInformation<?>[] fieldInfo = typeInfo.getFieldTypes();
+               final List<LogicalType> fieldTypes = 
rowType.getFields().stream()
+                       .map(RowType.RowField::getType)
+                       .collect(Collectors.toList());
                final int length = fields.size();
                final Row row = new Row(length);
                for (int i = 0; i < length; i++) {
                        final Schema.Field field = fields.get(i);
-                       row.setField(i, convertAvroType(field.schema(), 
fieldInfo[i], record.get(i)));
+                       row.setField(i, convertAvroType(field.schema(), 
fieldTypes.get(i), record.get(i)));
                }
                return row;
        }
 
-       private Object convertAvroType(Schema schema, TypeInformation<?> info, 
Object object) {
+       private Object convertAvroType(Schema schema, LogicalType type, Object 
object) {
                // we perform the conversion based on schema information but 
enriched with pre-computed
 
 Review comment:
   update 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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to