*QUERY*: my_issue_table a CROSS JOIN UNNEST(JSO...
# troubleshooting
n
QUERY: my_issue_table a CROSS JOIN UNNEST(JSON_QUERY( a.itemsImpacted, '$' WITH CONDITIONAL ARRAY WRAPPER )) AS t (tag) ERROR: org.apache.flink.table.api.ValidationException: SQL validation failed. From line 3, column 12 to line 3, column 114: Cannot apply 'UNNEST' to arguments of type 'UNNEST(<VARCHAR(2147483647)>)'. Supported form(s): 'UNNEST(MULTISET)' 'UNNEST(ARRAY)' 'UNNEST(MAP)' UNNEST(MULTISET) UNNEST(ARRAY) UNNEST(MAP) https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/dev/table/functions/systemfunctions/#json-functions according to the documentation JSON_QUERY should return an array but it is still a varchar. FLINK version 1.16.1 am i missing something?
m
The return type of JSON_QUERY is always returned as a STRING, but you can't UNNEST a STRING
✅ 1
t
I ran into similar situation. I wrote a UDF to deserialize STRING to Array and pass that to UNNEST
m
I think the best solution would be to add support for RETURNING to the JSON_QUERY function
n
yes