Skip to content
New issue

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

[CH] Use get_json_object instead of from_json #8406

Open
lgbo-ustc opened this issue Jan 3, 2025 · 1 comment · May be fixed by #8409
Open

[CH] Use get_json_object instead of from_json #8406

lgbo-ustc opened this issue Jan 3, 2025 · 1 comment · May be fixed by #8409
Labels
enhancement New feature or request performance

Comments

@lgbo-ustc
Copy link
Contributor

Description

We find some user will first tranform a json string into a map or other structure, and then access one field of the strcuture, as following

from_json(json_str, 'map<string,string>')['live_type']

We may could use get_json_object to replace this query.

@lgbo-ustc lgbo-ustc added enhancement New feature or request performance labels Jan 3, 2025
@lgbo-ustc
Copy link
Contributor Author

We compare the two methods as following

select count(x) from (select from_json(s, 'Map<String, String>')['key2'] as x from test_map_json);

image

select count(x) from (select get_json_object(s, '$.key2') as x from test_map_json);

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
None yet
1 participant