Support Questions

Find answers, ask questions, and share your expertise

Default Value Error by JsonTreeReader on using InferAvroSchema generated schema

avatar
{
	"name": "userAgreement",
        "type": [
        	"null",
                "boolean"
                ],
         "default": null
}

This is the schema for one of the fields of my json data, auto-generated using InferAvroSchema processor.

The field 'userAgreement is an optional field, and when missing the value should be set to null. So the schema seems to be generated correctly. However, on partitioning this data using PartitionRecord processor, the JsonTreeReader throws this error.

..will route to failure: org.apache.nifi.schema.access.SchemaNotFoundException: 
java.lang.IllegalArgumentException: Cannot set the deafult value for field 'userAgreement' to [org.apache.avro.JsonProperties$Null@5d0e5e41] because this is not a valid value for Data Type [Boolean]

Any ideas what's going wrong?

1 ACCEPTED SOLUTION

avatar
Master Guru

This should be resolved in Apache NiFi 1.4.0 and HDF 3.1...

https://issues.apache.org/jira/browse/NIFI-4029

The title of the issue refers to Hortonworks Schema Registry, but it was a general problem when using a default value of null.

View solution in original post

2 REPLIES 2

avatar
Master Guru

This should be resolved in Apache NiFi 1.4.0 and HDF 3.1...

https://issues.apache.org/jira/browse/NIFI-4029

The title of the issue refers to Hortonworks Schema Registry, but it was a general problem when using a default value of null.

avatar

Thanks a lot Bryan! I had been pulling my hair out for days now over this.