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

ConvertRecord - Can't redefine

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.12.1
    • None
    • Core Framework
    • None
    • 18.04.1-Ubuntu

    Description

      ConvertRecord processor with settings
        Record Reader: JsonTreeReader (with Infer Schema)
        Record Writer: AvroRecordSetWriter (with Embed Avro Schema)
      Problem with two fields with name attributes.

      ConvertRecord[id=dc0f47e8-0175-1000-9f2c-184ff602c868] Failed to process StandardFlowFileRecord[uuid=5d1699a9-cde5-472b-a78b-79a155f3c4b2,claim=StandardContentClaim 
       [resourceClaim=StandardResourceClaim[id=1607356761339-4176, container=default, section=80], offset=454572, length=7824],offset=4958,name=e4a67bb4-68b5-4ca7-8967-6f68f94e9874,size=865]; 
       will route to failure: Can't redefine: org.apache.nifi.attributesType

      Example below (paths $.agreement.attributes and $.plans[0].attributes)

      Input JSON

      {
         "agreement":{
            "id":"6e07e04d-d644-bf76-f30f-ce648da478e0",
            "type":"agreement",
            "attributes":{
               "code":"16-00-04332-20-01",
               "origin_code":"07-19-305",
               "service_type":"07",
               "service_name":"Leczenie stomatologiczne",
               "amount":112500.0,
               "updated_at":"2019-12-13T08:39:20",
               "provider_code":"160004332",
               "provider_name":"ISP STOMATOLOGICZNA JANUSZ KUBRAK",
               "provider_place":"SZCZECIN",
               "year":2020,
               "branch":"16"
            },
            "links":null
         },
         "plans":[
            {
               "id":"e040eca0-ab80-5823-8ab7-0333d2063159",
               "type":"agreement-plan",
               "attributes":{
                  "product_code":"07.0000.214.02",
                  "product_name":"ŚWIADCZENIA PROTETYKI STOMATOLOGICZNEJ",
                  "order":1,
                  "unit_count":90000.0,
                  "price":112500.0,
                  "avg_price":1.25
               },
               "links":{
                  "related":"https://api.nfz.gov.pl/app-umw-api/plans/e040eca0-ab80-5823-8ab7-0333d2063159?format=json"
               }
            }
         ],
         "orthopedic_supplies":[
            
         ]
      }

      Workaround: JoltTransformationJSON shift:

      {
         "agreement":{
            "attributes":"agreement.attr",
            "*":"agreement.&"
         },
         "*":"&"
      }

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            hipotures hipotures
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: