Steve Champagne created NIFI-3879:
-------------------------------------
Summary: Null Avro Values
Key: NIFI-3879
URL: https://issues.apache.org/jira/browse/NIFI-3879
Project: Apache NiFi
Issue Type: Bug
Reporter: Steve Champagne
Attachments: NullableField.xml
I'm getting an error from the convertRecord processor saying an Avro Schema
couldn't be found. I've narrowed it down to the processor thinking that my
schema is invalid. Would it be possible to change the log message to say when
the schema is invalid instead?
In my schema I have a field that is optional, so I'm using a null default. This
is what the processor thinks is invalid about it. I tried the same schema using
the Java avro library and it seems like it's valid.
I've attached an example template and here's the java code I'm using.
{code:java}
Schema schema = new
Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Test\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"deleted\",\"type\":[\"null\",\"boolean\"],\"default\":null}]}");
GenericRecord t1 = new GenericData.Record(schema);
t1.put("name", "Bob");
ByteArrayOutputStream out = new ByteArrayOutputStream();
DatumWriter<GenericRecord> datumWriter = new
GenericDatumWriter<GenericRecord>(schema);
DataFileWriter<GenericRecord> dataFileWriter = new
DataFileWriter<GenericRecord>(datumWriter);
dataFileWriter.create(schema, out);
dataFileWriter.append(t1);
dataFileWriter.close();
System.out.println(new String(out.toByteArray()));
{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)