[
https://issues.apache.org/jira/browse/NIFI-3879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16008561#comment-16008561
]
ASF GitHub Bot commented on NIFI-3879:
--------------------------------------
Github user markap14 commented on the issue:
https://github.com/apache/nifi/pull/1792
@champagst - was able to verify the issue with your template. Then applied
the PR and verified that it addressed the problem. Many thanks again! Merged
this to master. Excited to see this getting used already!
> 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)