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

ConvertRecord cannot handle open enum in Avro

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.12.1
    • 1.13.0
    • None
    • None

    Description

      This avro schema is using the open enum pattern:

      {
          "namespace": "acme",
          "name": "openEnum",
          "type": "record",
          "fields": [{
                  "name": "personType",
                  "type": ["null", {
                          "type": "enum",
                          "name": "personType_enum",
                          "symbols": [
                              "DRIVER",
                              "TECHNICIAN"
                          ]
                      }, "string"],
                  "default": null
              }
          ]
      }
      

      The personType can be either null, an enum, or any string. This brings forward-compatibility.
      Using ConvertRecord with

      {"personType":"DRIVER"}

      as a payload, it works.
      But with

      {"personType":"DUDE"}

      it fails with java.lang.NullPointerException: null of acme.personType_enum of union in field personType of acme.openEnum

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            pvillard Pierre Villard
            kpnc Christophe Monnet
            Votes:
            0 Vote for this issue
            Watchers:
            3 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 - 1h 50m
                1h 50m

                Issue deployment