markap14 commented on a change in pull request #3223: NIFI-5903: Allow 
RecordPath to be used in QueryRecord processor. Also…
URL: https://github.com/apache/nifi/pull/3223#discussion_r256110098
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryRecord.java
 ##########
 @@ -565,4 +588,232 @@ public Connection getConnection() {
             return connection;
         }
     }
+
+
+    // ------------------------------------------------------------
+    // User-Defined Functions for Calcite
+    // ------------------------------------------------------------
+
+
+    public static class ObjectRecordPath extends RecordPathFunction {
+        public Object eval(Object record, String recordPath) {
+            if (record == null) {
+                return null;
+            }
+
+            if (record instanceof Record) {
+                return eval((Record) record, recordPath);
+            }
+            if (record instanceof Record[]) {
+                return eval((Record[]) record, recordPath);
+            }
+
 
 Review comment:
   You should be able to reference it as a Map Key: `select * from flowfile 
where RPATH(previousAttributes, '.[''file.group'']') = 'staff'`
   Unfortunately, that didn't work previous but I just pushed another commit 
that should make it work well. If you want to use it in the SELECT clause, 
though, you'll need to ensure that you use RPATH_STRING instead of RPATH.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to