Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2207#discussion_r145169184
  
    --- Diff: 
nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java
 ---
    @@ -239,4 +243,20 @@ public void testComplicatedRecursiveSchema() {
             Assert.assertEquals(recordASchema, 
((RecordDataType)recordBParentField.get().getDataType()).getChildSchema());
         }
     
    +    @Test
    +    public void testMapWithNullSchema() throws IOException {
    +
    +        Schema recursiveSchema = new 
Schema.Parser().parse(getClass().getResourceAsStream("schema.json"));
    +
    +        // Make sure the following doesn't throw an exception
    +        RecordSchema recordASchema = 
AvroTypeUtil.createSchema(recursiveSchema.getTypes().get(0));
    +
    +        // check the fix with the proper file
    +        try(DataFileStream<GenericRecord> r = new 
DataFileStream<>(getClass().getResourceAsStream("data.avro"),
    --- End diff --
    
    Can you explain more about what's going on here, including what is in the 
data.avro file? When I run avro-tools tojson on it, I get the following:
    
    ```
    java -jar avro-tools-1.8.1.jar tojson datasets/data.avro
    {"a.A":{"o":{"a.O":{"hash":{"map":{}}}}}}
    ```
    
    Perhaps it would be good to have a test file that has a record with a 
non-null value for hash, as well as a record with a null value for hash?


---

Reply via email to