You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Mark Payne (Jira)" <ji...@apache.org> on 2023/09/22 21:05:00 UTC

[jira] [Updated] (NIFI-12118) RemoveRecordField does not work if specifying FlowFile attributes, or if using predicates

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

Mark Payne updated NIFI-12118:
------------------------------
    Summary: RemoveRecordField does not work if specifying FlowFile attributes, or if using predicates  (was: RemoveRecordField does not work if specifying FlowFile attributes)

> RemoveRecordField does not work if specifying FlowFile attributes, or if using predicates
> -----------------------------------------------------------------------------------------
>
>                 Key: NIFI-12118
>                 URL: https://issues.apache.org/jira/browse/NIFI-12118
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>            Priority: Major
>
> The Processor compiles all Record Paths on the first call to onTrigger, in the {{process}} method. To do this, it evaluates all dynamic properties against expression language. It then caches these compiled RecordPaths, and it never evaluates FlowFile attributes again. So if I configure the processor to remove /fields/${fieldName} and I then pass in a FlowFile where attribute {{fieldName}} is {{hello}} it will remove {{{}/fields/hello{}}}. But if the next FlowFile has the attribute value {{greeting}} it will still remove {{/fields/hello}} instead of removing {{/fields/greeting}}
> Additionally, the processor is not thread-safe. It uses a {{volatile List}} to store these RecordPaths. But if more than one Concurrent Task is set, any of the threads could win the race and set the value.
> It also appears that not all RecordPath expressions work. I created the following JSON:
> {code:json}
> {
>  "name": "MyCo, Inc.",
>  "addresses": [
>     {
> 	"name": "work",
>         "street": "1234 My Street",
>     	"city": "My City",
>   	"state": "MS",
>    	"zipcode": "90210"
>     }, {
> 	"name": "home",
>         "street": "1234 Your Street",
>     	"city": "Your City",
>   	"state": "YS",
>    	"zipcode": "44112"
>     }
>   ],
>   "industry": "IT",
>   "ceo": {
>      "name": "Mr. CEO",
>      "ssn": "444-33-2211",
>      "city": "Your City"
>   }
> }{code}
> I then configured it to removeĀ 
> {code:java}
> /addresses[0][./city = /ceo/city] {code}
> Which should have removed the second element in the array, but it did not remove any elements.



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