Member since
10-07-2022
8
Posts
0
Kudos Received
0
Solutions
03-17-2023
06:08 AM
1 Kudo
@anton123 Please check these references, there is important information here that everyone needs to master in order to work with ExecuteScript: https://community.hortonworks.com/articles/75032/executescript-cookbook-part-1.html https://community.hortonworks.com/articles/75545/executescript-cookbook-part-2.html https://community.hortonworks.com/articles/77739/executescript-cookbook-part-3.html Some suggestions: Make sure you have all the imports you need Make sure you are using the correct variable names for "filter". You have this defined but its not used.
... View more
03-17-2023
01:00 AM
Well if I understand your flow logic correctly, what you are trying to achieve is not really possible, so please correct me if I am wrong. In your QueryRecord you receive input from the InputPort and from the QueryDatabaseTable Flow as well. Based on the FlowFile coming from that InputPort, you are trying to filter the data, using a SQL which is built on the input coming from the QueryDatabaseTable Flow, right? Basically you want to filter the InputPort Data (FlowFile1) based on the ${value} from QueryDatabaseTable (FlowFile2). Based on my current experience with NiFi, such a thing is not possible because the processors work on a single FlowFile and not with 2+ FlowFiles (unless merged). But maybe somebody with more experience can tell you otherwise. You would need to rethink your flow and build something else --> hence the idea with LookupRecord/LookupAttribute.
... View more
01-24-2023
08:57 AM
Hi, Try the following: [
{
"operation": "shift",
"spec": {
"*": {
"*": "[#2].&",
"$": "[#2].product"
}
}
}
] If that helps please accept solution. Thanks
... View more
01-17-2023
11:16 AM
Hi, Not sure if you are looking for the exact thing but this should give you the expected output from the sample you provided: [
// Flatten an array of photo objects into a prefixed
// soup of properties.
{
"operation": "shift",
"spec": {
"content": {
"*": {
"*": {
"*": {
"$": "error",
"$1": "product",
"$2": "ErrorType",
"@": "q"
}
}
}
}
}
}
] If that helps, please accept solution. Thanks
... View more
12-21-2022
06:18 AM
@anton123 I am still not completely clear on your use, but correct me if below is not accurate: 1. You fetch a single large file. 2. That file is unpacked in to many smaller files. 3. Each of these smaller files are converted in to SQL and inserted via the putSQL processor. 4. You then have unrelated downstream processing you don't want to start until all files produced by the unpackContent processor have been successfully processed by the putSQL processor. Correct? If so, the following exampe use case for the NiFi Wait and Notify processor is probably what you are looking to implement for this use case: https://pierrevillard.com/2018/06/27/nifi-workflow-monitoring-wait-notify-pattern-with-split-and-merge/ If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped. Thank you, Matt
... View more
10-10-2022
09:20 AM
How can I break and flatten nested JSON with arrays using Jolt transformations
from:
{
"product": [
"data - 1",
"data - 2"
],
"Purchase": [
2,
2
],
"Renewal": 1
}
to
[
{
"product": "data -1",
"Purchase": 1,
"Renewal": 1
},
{
"product": "data -2",
"Purchase": 2,
}
]
My current jolt transformation doesn't give me fully accurate transformation
[
{
"operation": "shift",
"spec": {
"*": {
"*": {
"@": "[#2].&2"
}
}
}
}
]
... View more
Labels:
- Labels:
-
Apache NiFi