MikeThomsen commented on a change in pull request #3267: NIFI-5943 support conversions from List to Avro ARRAY and from Map to Avro RECORD URL: https://github.com/apache/nifi/pull/3267#discussion_r256830224
########## File path: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java ########## @@ -672,10 +673,20 @@ private static Object convertToAvroObject(final Object rawValue, final Schema fi case RECORD: final GenericData.Record avroRecord = new GenericData.Record(fieldSchema); - final Record record = (Record) rawValue; - for (final RecordField recordField : record.getSchema().getFields()) { - final Object recordFieldValue = record.getValue(recordField); - final String recordFieldName = recordField.getFieldName(); + final Set<Map.Entry<String, Object>> entries; + if (rawValue instanceof Map) { + final Map<String, Object> map = (Map<String, Object>) rawValue; + entries = map.entrySet(); + } else if (rawValue instanceof Record) { + entries = new HashSet<>(); + final Record record = (Record) rawValue; + record.getSchema().getFields().forEach(field -> entries.add(new AbstractMap.SimpleEntry<>(field.getFieldName(), record.getValue(field)))); Review comment: We had some issues in the past, but I did some additional experimentation with JUnit and found that it finally appears to be OBE now. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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