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

LookUpRecord does not work for arrays if look up value is missing for a key in the array

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

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.15.0
    • 1.16.0
    • Extensions
    • None
    • apache/nifi:1.15.0 official docker image

    Description

      I tried to use the LookUpRecord processor with the example shown on https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.15.0/org.apache.nifi.processors.standard.LookupRecord/additionalDetails.html page under "Record Update Strategy - Replace Existing Values" section.

      In the Simple Key Value Lookup Service I defined the following key-value pairs (Note: that FR key is missing on purpose):

      • US => United States
      • CA => Canada

       

      I created a GenerateFlowFile processor to create a file with the following content:

      [
          {
              "locales": [
                 

      {                 "region": "FR",                 "language": "fr"             }

      ,

      {                 "region": "US",                 "language": "en"             }

              ]
          }, {
              "locales": [
                 

      {                 "region": "CA",                 "language": "fr"             }


                 

      {                 "region": "JP",                 "language": "ja"             }

              ]
          }
      ]

       

      The LookUpRecord is configured as follows:

      JsonTreeReader and JsonRecordSetWriter are just configured with infer and inherit schema.

      Once LookUpRecord is executed, "US" values is not looked up and replaced. The reason for this since "FR" cannot be looked up, line 343 in LookUpRecord.java (https://github.com/apache/nifi/blob/7fe8858d22f580ad9dcd96ebafb59dbe5e73f5cb/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/LookupRecord.java#L341) returns before attempting to look up the "US" value.

      I would expect that in this case "US" is still looked up regardless if "FR" key can be looked up or not.

       

      Please find enclosed the NiFi template for reproducing the issue.

       

      Attachments

        Activity

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

          People

            pvillard Pierre Villard
            pem Peter Molnar
            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 - 0.5h
                0.5h

                Slack

                  Issue deployment