[
https://issues.apache.org/jira/browse/NIFI-9545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17490748#comment-17490748
]
Peter Molnar edited comment on NIFI-9545 at 2/11/22, 8:42 AM:
--------------------------------------------------------------
[~pvillard] sorry to reopen this issue but as I was playing more and more with
the LookUpRecord processor, I found a behaviour that I cannot decide if it is a
bug or feature. In case you confirm this is a bug, I can create separate ticket
for this if you wish.
Once I made a custom NiFi build from the github repo that contained the fix for
this original issue, I was able to use several dynamic properties as expected
(and described by the documentation):
See attached image screenshot_4647.
But I got a strange behaviour in the following scenario.
My input JSON generated by GenerateFlowFile processor looks like this (actually
I just added a currencies array under each record):
{code:java}
[
{
"locales": [
{
"region": "FR",
"language": "fr"
}, {
"region": "US",
"language": "en"
}
],
"currencies": [
{
"currency": "EUR"
}, {
"currency": "USD"
}
]
}, {
"locales": [
{
"region": "CA",
"language": "fr"
},
{
"region": "JP",
"language": "ja"
}
],
"currencies": [
{
"currency": "CAD"
}, {
"currency": "JPY"
}
]
}
]
{code}
Then I extended the SimpleKeyValueLookUp with values like:
See attached image screenshot_4648.
And I extend the LookUpRecord processor with "currency" path like this:
See attached image screenshot_4649.
Until this all worked fine and I got the expected output (locales, languages
and currencies looked up):
See attached image screenshot_4650.
The issue comes when I replace the first "currencies" array with empty array
(assuming that the data is incomplete and we don't have currencies information
for that record). So the new generated flow file content is the following:
{code:java}
[
{
"locales": [
{
"region": "FR",
"language": "fr"
}, {
"region": "US",
"language": "en"
}
],
"currencies": []
}, {
"locales": [
{
"region": "CA",
"language": "fr"
},
{
"region": "JP",
"language": "ja"
}
],
"currencies": [
{
"currency": "CAD"
}, {
"currency": "JPY"
}
]
}
]
{code}
Once I execute the very same LookUpRecord processor that worked in the previous
case, I got a bit strange output. Language look up works fine, but the look up
for currencies and regions are gone:
See attached image screenshot_4651.
Please find the template for reproducing the issue enclose as
LookUpRecord_empty_array_data_issue.xml.
Could you please advice if this is a feature or a bug? Thanks a lot.
was (Author: JIRAUSER283162):
[~pvillard] sorry to reopen this issue but as I was playing more and more with
the LookUpRecord processor, I found a behaviour that I cannot decide if it is a
bug or feature. In case you confirm this is a bug, I can create separate ticket
for this if you wish.
Once I made a custom NiFi build from the github repo that contained the fix for
this original issue, I was able to use several dynamic properties as expected
(and described by the documentation):
!image-2022-02-11-09-23-54-367.png!
But I got a strange behaviour in the following scenario.
My input JSON generated by GenerateFlowFile processor looks like this (actually
I just added a currencies array under each record):
{code:java}
[
{
"locales": [
{
"region": "FR",
"language": "fr"
}, {
"region": "US",
"language": "en"
}
],
"currencies": [
{
"currency": "EUR"
}, {
"currency": "USD"
}
]
}, {
"locales": [
{
"region": "CA",
"language": "fr"
},
{
"region": "JP",
"language": "ja"
}
],
"currencies": [
{
"currency": "CAD"
}, {
"currency": "JPY"
}
]
}
]
{code}
Then I extended the SimpleKeyValueLookUp with values like:
!image-2022-02-11-09-26-33-114.png!
And I extend the LookUpRecord processor with "currency" path like this:
!image-2022-02-11-09-27-47-419.png!
Until this all worked fine and I got the expected output (locales, languages
and currencies looked up):
!image-2022-02-11-09-29-03-624.png!
The issue comes when I replace the first "currencies" array with empty array
(assuming that the data is incomplete and we don't have currencies information
for that record). So the new generated flow file content is the following:
{code:java}
[
{
"locales": [
{
"region": "FR",
"language": "fr"
}, {
"region": "US",
"language": "en"
}
],
"currencies": []
}, {
"locales": [
{
"region": "CA",
"language": "fr"
},
{
"region": "JP",
"language": "ja"
}
],
"currencies": [
{
"currency": "CAD"
}, {
"currency": "JPY"
}
]
}
]
{code}
Once I execute the very same LookUpRecord processor that worked in the previous
case, I got a bit strange output. Language look up works fine, but the look up
for currencies and regions are gone:
!image-2022-02-11-09-34-18-979.png! Could you please advice if this is a
feature or a bug? Thanks a lot.
> LookUpRecord's Record Update Strategy example is not working
> ------------------------------------------------------------
>
> Key: NIFI-9545
> URL: https://issues.apache.org/jira/browse/NIFI-9545
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.15.0
> Environment: apache/nifi:1.15.0 official docker image
> Reporter: Peter Molnar
> Assignee: Pierre Villard
> Priority: Major
> Fix For: 1.16.0
>
> Attachments: LookUpRecord_empty_array_data_issue.xml,
> LookUpRecord_key_name_issue.xml, image-2022-01-06-15-56-49-217.png,
> image-2022-01-06-15-58-08-315.png, screenshot_4647.png, screenshot_4648.png,
> screenshot_4649.png, screenshot_4650.png, screenshot_4651.png
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> I tried to use LookUpRecord as described in the "Record Update Strategy -
> Replace Existing Values" section here
> [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]
> I created a SImpleKeyValue Lookup service with the following values:
> * FR => France
> * CA => Canada
> I created a generate flow file processor with the mentioned JSON input.
> I configured LookUpRecord as follows:
> !image-2022-01-06-15-56-49-217.png!
> Once LookUpRecord is executed, I see the following error message:
> !image-2022-01-06-15-58-08-315.png!
>
> Practically it looks to me that most of the LookUpServices provided with NiFi
> uses hard coded "key" as the name of the key. I am not sure how a key called
> "region" is supposed to work with Simple Key Value Lookup Service.
>
> Please find enclosed a template for reproducing the problem.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)