You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "David Handermann (Jira)" <ji...@apache.org> on 2024/02/02 22:26:00 UTC

[jira] [Resolved] (NIFI-12707) Allow LookupRecord to operate on multiple "child records"

     [ https://issues.apache.org/jira/browse/NIFI-12707?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Handermann resolved NIFI-12707.
-------------------------------------
    Fix Version/s: 2.0.0
       Resolution: Fixed

> Allow LookupRecord to operate on multiple "child records"
> ---------------------------------------------------------
>
>                 Key: NIFI-12707
>                 URL: https://issues.apache.org/jira/browse/NIFI-12707
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>            Priority: Major
>             Fix For: 2.0.0
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> LookupRecord provides a lot of power when it comes to performing enrichment in Records. However, there are cases in which a single Record has many sub-records, or child records. For example, let's take the following record:
> {code:java}
> {
>   "fileSet": {
>     "id": "11223344",
>     "source": "external",
>     "files": [{
>         "filename": "file1.txt",
>         "size": 4810
>       }, {
>         "filename": "file2.pdf",
>         "size": 47203782
>       }, {
>         "filename": "unknown-file.unk",
>         "size": 278102
>       }
>     ]
>   }
> } {code}
> Let's say that I want to lookup a MIME type, based on the filename. So I want an output such as:
> {code:java}
> {
>   "fileSet" : {
>     "id" : "11223344",
>     "source" : "external",
>     "files" : [ {
>       "filename" : "file1.txt",
>       "size" : 4810,
>       "mimeType" : "text/plain"
>     }, {
>       "filename" : "file2.pdf",
>       "size" : 47203782,
>       "mimeType" : "application/pdf"
>     }, {
>       "filename" : "unknown-file.unk",
>       "size" : 278102,
>       "mimeType" : null
>     } ]
>   }
> } {code}
>  
> I can have a Lookup Service that is capable of handling this, no problem. And in LookupRecord, I can specify the path to lookup as {{/fileSet/files[*]/filename}} but then I have a problem - there's no way to tell it where to place the returned values (i.e., the mimeType field) because it is relative to each individual value.
> We need to add a "Root Record Path" that allows us to choose a sub-record. In this case, {{/fileSet/files[*]}} and then specify the value to lookup as {{/filename}} and the return value should be placed at {{{}/mimeType{}}}.
> This gives us much greater flexibility in performing lookups/enrichments.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)