[jira] [Updated] (NIFI-5802) QueryRecord ignores field nullability and causes NPE with null input value
[ https://issues.apache.org/jira/browse/NIFI-5802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Koji Kawamura updated NIFI-5802: Description: WIth Avro schema, a field can be defined as nullable by a union type. For example: {code:java} "type": [ "null", "boolean" ] {code} QueryRecord generates relational data types from the record schema. But it currently doesn't utilize the nullable information. And it leads to a NullPointerException when the incoming FlowFile has null values for the nullable fields. A simple 'select * from FLOWFILE' can fail, if the AvroRecordSetWriter is used. This issue was reported to nifi user ML. See the message for detail. [https://mail-archives.apache.org/mod_mbox/nifi-users/201811.mbox/%3CCAB10SGVgW2NR76UR1pYJvEZYTO3J1T7t_0q%2BUsQANp%3DcHxS-kw%40mail.gmail.com%3E] was: WIth Avro schema, a field can be defined as nullable by a union type. For example: {code} "type": [ "null", "boolean" ] {code} QueryRecord generates relational data types from the record schema. But it currently doesn't utilize the nullable information. And it leads to a NullPointerException when the incoming FlowFile has null values for the nullable fields. A simple 'select * from FLOWFILE' can fail. This issue was reported to nifi user ML. See the message for detail. https://mail-archives.apache.org/mod_mbox/nifi-users/201811.mbox/%3CCAB10SGVgW2NR76UR1pYJvEZYTO3J1T7t_0q%2BUsQANp%3DcHxS-kw%40mail.gmail.com%3E > QueryRecord ignores field nullability and causes NPE with null input value > -- > > Key: NIFI-5802 > URL: https://issues.apache.org/jira/browse/NIFI-5802 > Project: Apache NiFi > Issue Type: Bug > Components: Extensions >Affects Versions: 1.2.0 >Reporter: Koji Kawamura >Assignee: Koji Kawamura >Priority: Major > > WIth Avro schema, a field can be defined as nullable by a union type. For > example: > {code:java} > "type": [ "null", "boolean" ] > {code} > QueryRecord generates relational data types from the record schema. But it > currently doesn't utilize the nullable information. And it leads to a > NullPointerException when the incoming FlowFile has null values for the > nullable fields. > A simple 'select * from FLOWFILE' can fail, if the AvroRecordSetWriter is > used. > This issue was reported to nifi user ML. See the message for detail. > > [https://mail-archives.apache.org/mod_mbox/nifi-users/201811.mbox/%3CCAB10SGVgW2NR76UR1pYJvEZYTO3J1T7t_0q%2BUsQANp%3DcHxS-kw%40mail.gmail.com%3E] -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (NIFI-5802) QueryRecord ignores field nullability and causes NPE with null input value
[ https://issues.apache.org/jira/browse/NIFI-5802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Koji Kawamura updated NIFI-5802: Description: WIth Avro schema, a field can be defined as nullable by a union type. For example: {code:java} "type": [ "null", "boolean" ] {code} QueryRecord generates relational data types from the record schema. But it currently doesn't utilize the nullable information. And it leads to a NullPointerException when the incoming FlowFile has null values for the nullable fields. A simple 'select * from FLOWFILE' can fail, if the AvroRecordSetWriter is used. This issue was reported to nifi user ML. See the message for detail. [https://mail-archives.apache.org/mod_mbox/nifi-users/201811.mbox/%3CCAB10SGVgW2NR76UR1pYJvEZYTO3J1T7t_0q%2BUsQANp%3DcHxS-kw%40mail.gmail.com%3E] Here is the full stack trace: {code} org.apache.nifi.processor.exception.ProcessException: IOException thrown from QueryRecord[id=f11017d1-0166-1000-344a-c2f1d9bbd933]: java.io.IOException: org.apache.avro.file.DataFileWriter$AppendWriteException: java.lang.NullPointerException: null of boolean in field bool_test of org.apache.nifi.nifiRecord at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2667) at org.apache.nifi.processors.standard.QueryRecord.onTrigger(QueryRecord.java:309) at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1168) at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:203) at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: org.apache.avro.file.DataFileWriter$AppendWriteException: java.lang.NullPointerException: null of boolean in field bool_test of org.apache.nifi.nifiRecord at org.apache.nifi.processors.standard.QueryRecord$1.process(QueryRecord.java:327) at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2648) ... 12 common frames omitted Caused by: org.apache.avro.file.DataFileWriter$AppendWriteException: java.lang.NullPointerException: null of boolean in field bool_test of org.apache.nifi.nifiRecord at org.apache.avro.file.DataFileWriter.append(DataFileWriter.java:308) at org.apache.nifi.avro.WriteAvroResultWithSchema.writeRecord(WriteAvroResultWithSchema.java:61) at org.apache.nifi.serialization.AbstractRecordSetWriter.write(AbstractRecordSetWriter.java:59) at org.apache.nifi.serialization.AbstractRecordSetWriter.write(AbstractRecordSetWriter.java:52) at org.apache.nifi.processors.standard.QueryRecord$1.process(QueryRecord.java:324) ... 13 common frames omitted Caused by: java.lang.NullPointerException: null of boolean in field bool_test of org.apache.nifi.nifiRecord at org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:132) at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:126) at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:73) at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:60) at org.apache.avro.file.DataFileWriter.append(DataFileWriter.java:302) ... 17 common frames omitted Caused by: java.lang.NullPointerException: null at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:121) at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:73) at org.apache.avro.generic.GenericDatumWriter.writeField(GenericDatumWriter.java:153) at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:143) at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:105) ... 20 common frames omitted {code} was: WIth Avro schema, a field can be defined as nullable by a union type. For example: {code:java} "type": [ "null", "boolean" ] {code} QueryRecord generates relational data types from the reco