[ 
https://issues.apache.org/jira/browse/NIFI-5138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16469057#comment-16469057
 ] 

ASF subversion and git services commented on NIFI-5138:
-------------------------------------------------------

Commit 4700b8653dc980b1cf8985430683b79eb64922a4 in nifi's branch 
refs/heads/master from [~markap14]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=4700b86 ]

NIFI-5138: Bug fix to ensure that when we have a CHOICE between two or more 
REOCRD types that we choose the appropriate RECORD type when creating the 
Record in the JSON Reader.

Signed-off-by: Pierre Villard <[email protected]>

This closes #2670.


> JSON Record Readers providing wrong schema to sub-records when there is a 
> CHOICE of multiple RECORD types
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-5138
>                 URL: https://issues.apache.org/jira/browse/NIFI-5138
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>            Priority: Major
>             Fix For: 1.7.0
>
>
> When the JSON Record Reader is used, if the schema provides a CHOICE of two 
> different RECORD types for a sub-record, then the sub-record's schema ends up 
> being an empty schema. This results in RecordPath's not properly evaluating. 
> For example, with the schema below:
> {code:java}
> {
>   "name": "top", "namespace": "nifi",
>   "type": "record",
>   "fields": [
>     { "name": "id", "type": "string" },
>     { "name": "child", "type": [{
>          "name": "first", "type": "record",
>          "fields": [{ "name": "name", "type": "string" }]
>        }, {
>          "name": "second", "type": "record",
>          "fields": [{ "name": "id", "type": "string" }]
>        }]
>      }
>   ]
> }{code}
>  
> If I then have the following JSON:
> {code:java}
> {
>   "id": "1234",
>   "child": {
>       "id": "4321"
>   }
> }{code}
> The result is that the record returned has the correct schema. However, if I 
> then call record.getValue("child") I am returned a Record object that has no 
> schema.
> This results in the RecordPath "/child/id" returning a null value.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to