We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create table temp.test_explode (userid string, log string) partitioned by (day string) stored as orc; insert into table temp.test_explode partition (day = '2017-11-01') values ('u1', '[{ "action": "a" }, { "action": "b"} ]'); insert into table temp.test_explode partition (day = '2017-11-02') values ('u2', '[{ "action": "a" , "arg1": "1"}, { "action": "b", "arg2": "2"} ]'); create temporary function udf_json_array_extract as 'cc.shanruifeng.functions.json.UDFJsonArrayExtract'; create temporary function udf_json_array_extract_scalar as 'cc.shanruifeng.functions.json.UDFJsonExtractScalar'; select userid, udf_json_array_extract ( log, '$.action' ) from temp.test_explode where day = '2017-11-01'; -- result u1 ["\"a\"","\"b\""] select userid, udf_json_array_extract_scalar ( log, '$.action' ) from temp.test_explode where day = '2017-11-01'; -- result u1 NULL
I want to get an array like ["a","b"], in the above second query, I got NULL.
Am I using wrong syntax for json path? What is the syntax for the path?
The text was updated successfully, but these errors were encountered:
@hamlet-lee your udf function define error. you should change UDFJsonExtractScalar to UDFJsonArrayExtractScalar . like this:
UDFJsonExtractScalar
UDFJsonArrayExtractScalar
create temporary function udf_json_array_extract_scalar as 'cc.shanruifeng.functions.json.UDFJsonArrayExtractScalar';
Sorry, something went wrong.
@aaronshan Thanks, I will try later
No branches or pull requests
I want to get an array like ["a","b"], in the above second query, I got NULL.
Am I using wrong syntax for json path? What is the syntax for the path?
The text was updated successfully, but these errors were encountered: