-
Notifications
You must be signed in to change notification settings - Fork 465
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]Optimize nested function calls #8557
Comments
印象之前是用spark rule改写成 |
改写成get_json_object(a, '$.b.c') , 有些case 兼容不了。 get_json_object(a, '$.b', '$.c') 不是spark |
什么case |
you can also look at the comments at |
Let's make things clear.
So we cannot use
|
The optimization for nested |
Is the rule in #8305 disable? |
rule in #8305 is disable by default as the not passed case. |
I have open a seperate PR for |
Hi @KevinyhZou, for |
Yes, it should be the problem of ch backend. |
Description
In our online sqls, there are many nested functions calls, such as
select a.b.c from test_tbl
=>select get_struct_field((get_struct_field(a, b),c) from test_tbl
select count(1) from test_tbl where a = 1 and b = 2 and c = 3
=>select count(1) from test_tbl where and(and(a = 1, b = 2), c = 3 )
select count(1) from test_tbl where a = 1 or b = 2 or c = 3
=>select count(1) from test_tbl where or(or(a = 1, b = 2), c = 3 )
.....
and these functions can be optimized by make the nested arguments collapsed , which means
get_struct_field((get_struct_field(a, b),c)
=> get_struct_field(a, b, c)and(and(a = 1, b = 2), c = 3 )
=> and(a =1, b=2, c=3)or(or(a=1, b= 2), c=3)
=> or(a=1, b=2, c=3)get_json_object(get_json_object(a, '$.b'), '$.c')
=>get_json_object(a, '$.b', '$.c')
.....
which can reduce the function calls and improve performance.
The text was updated successfully, but these errors were encountered: