[ https://issues.apache.org/jira/browse/NIFI-5802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16679239#comment-16679239 ]
ASF GitHub Bot commented on NIFI-5802: -------------------------------------- GitHub user ijokarumawak opened a pull request: https://github.com/apache/nifi/pull/3158 NIFI-5802: Add QueryRecord nullable field support Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Is your initial contribution a single, squashed commit? ### For code changes: - [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [x] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/ijokarumawak/nifi nifi-5802 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/3158.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3158 ---- commit 8bf29d4c56fb1f507d987c8aea774e5345b286f7 Author: Koji Kawamura <ijokarumawak@...> Date: 2018-11-08T03:10:36Z NIFI-5802: Add QueryRecord nullable field support ---- > 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] > 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} -- This message was sent by Atlassian JIRA (v7.6.3#76005)