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_r359209793
########## File path: flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroRowDeserializationSchema.java ########## @@ -218,67 +249,65 @@ private Object convertAvroType(Schema schema, TypeInformation<?> info, Object ob switch (schema.getType()) { case RECORD: if (object instanceof IndexedRecord) { - return convertAvroRecordToRow(schema, (RowTypeInfo) info, (IndexedRecord) object); + return convertAvroRecordToRow(schema, (RowType) type, (IndexedRecord) object); } throw new IllegalStateException("IndexedRecord expected but was: " + object.getClass()); case ENUM: case STRING: return object.toString(); case ARRAY: - if (info instanceof BasicArrayTypeInfo) { - final TypeInformation<?> elementInfo = ((BasicArrayTypeInfo<?, ?>) info).getComponentInfo(); - return convertToObjectArray(schema.getElementType(), elementInfo, object); - } else { - final TypeInformation<?> elementInfo = ((ObjectArrayTypeInfo<?, ?>) info).getComponentInfo(); - return convertToObjectArray(schema.getElementType(), elementInfo, object); - } + LogicalType elementType = ((ArrayType) type).getElementType(); + // transform to sql time conversion classes + DataType elementDataType = DataTypeUtils.transform( Review comment: Here were are in the hot path of the runtime code. We should avoid creating objects. IMHO this is another example that API classes (everything outside of planner) should use `DataType` instead. This adds no runtime overhead but only a bit of pre-flight overhead. ---------------------------------------------------------------- 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 With regards, Apache Git Services