You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/03/30 16:52:58 UTC

[GitHub] [nifi] pgyori commented on pull request #4934: NIFI-8365 Fix JSON AbstractJsonRowRecordReader to handle deep CHOICE-typed records properly

pgyori commented on pull request #4934:
URL: https://github.com/apache/nifi/pull/4934#issuecomment-810419344


   If you use the input data from the Jira ticket:
   {
     "dataCollection":[
       {
         "record": {
           "integer": 1,
           "boolean": true
         }
       },
       {
         "record": {
           "integer": 2,
           "string": "stringValue2"
         }
       }
     ]
   }
   
   and use ConvertRecord with JsonTreeReader and JsonRecordSetWriter, and configure the controller services the following way:
   JsonTreeReader:
    - Schema Access Strategy: Infer Schema
   JsonRecordSetWriter:
    - Schema Write Strategy: Set 'avro.schema' Attribute
    - Schema Access Strategy: Inherit Record Schema
    - Pretty Print JSON: true
   
   If you run the ConvertRecord processor with these settings, the schema that gets attached to the flowfile in the avro.schema attribute will not match the data, because the schema does not contain the schema of the second record (the one with "stringValue2").
   
   This way, if you copy the schema from the avro.schema attribute and set the Reader explicitly to use this schema (instead of inferring it) and run the ConvertRecord processor again (with the same input data), it will not read the "string": "stringValue2" part of the second record and the output of the processor will not contain this data.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org