Using QueryRecord i am trying to figure out how to find records which have a string in an array that start with a value
Given the below array, i would like only record which have a tag that start with '/test2/'
[ { "name":"bob", "tags":[ "/test1/foo","/alpha"] } , { "name":"bill", "tags":[ "/test2/blah","/beta"] } ]
Selecting as if it a flattened string
SELECT * FROM FLOWFILE WHERE tags LIKE '%/test2/blah']:
i get an exception saying we cannot compare against an Array.
Cannot apply 'LIKE' to arguments of type 'LIKE(<JAVATYPE(CLASS JAVA.LANG.STRING) ARRAY>
Treating it as a Record
SELECT * FROM FLOWFILE WHERE RPATH_STRING(tags, '/') LIKE '/test2/%'
due to java.lang.String cannot be cast to org.apache.nifi.serialization.record.Record: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.nifi.serialization.record.Record
The errors i am getting make sense, but i am not sure how to inspect an array which is just strings. Can somebody help point me in the right direction?