Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-8365

JSON record reader mishandles deep CHOICE types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.14.0
    • None
    • None

    Description

      The AbstractJsonRowRecordReader when trying to find the correct schema for a given record it may come with a wrong one.
      For example:

      Suppose the following record:

      {
        "dataCollection":[
          {
            "record": {
              "integer": 1,
              "boolean": true
            }
          },
          {
            "record": {
              "integer": 2,
              "string": "stringValue2"
            }
          }
        ]
      }
      

      Even if the schema is correctly set (which may not be the case as infer schema itself has a similar issue),
      the second record

          {
            "record": {
              "integer": 2,
              "string": "stringValue2"
            }
          }
      

      will be assigned the schema of the first (["integer" : "INT", "boolean" : "BOOLEAN"] instead of ["integer" : "INT", "string" : "STRING"]).

      This will cause the fields that are not present in the schema (in this case "string") to be omitted when writing it out.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tpalfy Tamas Palfy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h
                  1.5h