[ 
https://issues.apache.org/jira/browse/NIFI-5138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pierre Villard updated NIFI-5138:
---------------------------------
    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

> 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