[
https://issues.apache.org/jira/browse/NIFI-3879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16008556#comment-16008556
]
ASF subversion and git services commented on NIFI-3879:
-------------------------------------------------------
Commit 382eef2183192357c3823c207f1835711f57688c in nifi's branch
refs/heads/master from [~champagst]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=382eef2 ]
NIFI-3879: Allow null Avro default values
- Avro uses their own class for null values, so a standard check against
null isn't picking them up.
This closes #1792.
> 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)