1
votes

I consume data from a kafka topic (nested json) which has to be filtered based on a field value. So I used the ExecuteScript processor to filter out records and transform some fields. For filtering I used findAll function without using QueryRecord and it worked.

My question here is does this approach solve the same purpose as QueryRecord processor for filtering because I'm NOT sure how to use query record when there are nested json objects from the incoming flowfiles.

I tried queryrecord but it threw an error:

SELECT * FROM FLOWFILE WHERE RPATH(order, '/orderDetail/orderId') = '1126'

Error:
No match found for function signature RPATH(<JavaType(...Record)>,<CHARACTER>)
org.apache.calcite.runtime.CalciteContextException

Sample Data:

{  
   "retail":{  
      "retailId":"6133",
      "retailName":"Maveric"
   },
   "order":{  
      "orderDetail":{  
         "orderId":"1126",
         "orderName":"NNDRFG"
      }
   }
}
1

1 Answers

2
votes

RPATH_STRING is not the correct syntax, it is just RPATH.

See the additional details documentation for QueryRecord:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.2/org.apache.nifi.processors.standard.QueryRecord/additionalDetails.html

It has an example of JSON with nested fields.