clintropolis commented on issue #14374:
URL: https://github.com/apache/druid/issues/14374#issuecomment-1601690306
confirmed a bug with expression based usage of json_value to extract arrays
(so ingest time transforms and queries such as in this ticket), it will always
return null. #14461 mostly fixes the issue, though the query doesn't quite work
correctly as written due to the first expression, but if rewritten to use the
undocumented `JSON_VALUE_ANY`, it works - though still calls the output a
VARCHAR instead of VARCHAR ARRAY, which is probably ok since we can handle that
due to multi-value strings.
```with nested_data as ( SELECT
JSON_OBJECT('k1':ARRAY['v1','v2'],'k2':'v3','k3':4) json_arr )
SELECT
JSON_VALUE_ANY(json_arr,'$.k1') k1,
JSON_VALUE(json_arr,'$.k1' RETURNING VARCHAR ARRAY) k1_string_arr,
JSON_VALUE(json_arr,'$.k1' RETURNING INTEGER ARRAY) k1_int_arr,
JSON_VALUE(json_arr,'$.k2') k2,
JSON_VALUE(json_arr,'$.k2' RETURNING VARCHAR ARRAY) k2_string_arr,
JSON_VALUE(json_arr,'$.k2' RETURNING INTEGER ARRAY) k2_int_arr,
JSON_VALUE(json_arr,'$.k3') k3,
JSON_VALUE(json_arr,'$.k3' RETURNING VARCHAR ARRAY) k3_string_arr,
JSON_VALUE(json_arr,'$.k3' RETURNING INTEGER ARRAY) k3_int_arr
from nested_data```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]