-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Feat](nereids) add transform rule SimplifyWindowExpression #33647
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
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
|
run buildall |
TPC-H: Total hot run time: 38228 ms |
TPC-DS: Total hot run time: 184160 ms |
ClickBench: Total hot run time: 30.26 s |
|
Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G' |
|
run buildall |
TPC-H: Total hot run time: 38584 ms |
TPC-DS: Total hot run time: 183515 ms |
ClickBench: Total hot run time: 30.08 s |
|
Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G' |
|
run buildall |
TPC-H: Total hot run time: 38228 ms |
TPC-DS: Total hot run time: 182733 ms |
ClickBench: Total hot run time: 30.57 s |
|
Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G' |
|
run external |
|
run external regression |
|
run external |
|
run external regression |
|
run buildall |
TPC-H: Total hot run time: 38581 ms |
|
run p0 |
1 similar comment
|
run p0 |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this?
| * select max(c1) over(partition by pk) from t1; | ||
| * -> select c1 from t1; | ||
| * */ | ||
| public class SimplifyWindowExpression extends OneRewriteRuleFactory { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add annotation @DependsRules for denpends on normalize window
| Alias alias = (Alias) expr; | ||
| WindowExpression windowExpression = (WindowExpression) alias.child(); | ||
| if (!windowExpression.getOrderKeys().isEmpty()) { | ||
| remainWindowExpression.add(expr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if partition key is unique, order key is not use anymore, so why remain them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LogicalWindow
->
LogicalProject(projections)
+ LogicalWindow(remainWindowExpression)
remainWindowExpressions are the WindowExpressions that don't meet the conditions for optimization, and still need to be evaluated int LogicalWindow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tthe restriction has been removed
| return new LogicalProject(projections, window.withExpression(remainWindow, | ||
| window.child(0))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do u have case to test this branch? i think this is not right because project should contain remain window node's output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem has been modified and regression cases have been added
|
run buildall |
|
run buildall |
TPC-H: Total hot run time: 38169 ms |
|
run buildall |
|
run buildall |
1 similar comment
|
run buildall |
|
run p0 |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
rewrite func(para) over (partition by unique_keys) 1. func() is count(non-null) or rank/dense_rank/row_number -> 1 2. func(para) is min/max/sum/avg/first_value/last_value -> para e.g select max(c1) over(partition by pk) from t1; -> select c1 from t1;
rewrite func(para) over (partition by unique_keys) 1. func() is count(non-null) or rank/dense_rank/row_number -> 1 2. func(para) is min/max/sum/avg/first_value/last_value -> para e.g select max(c1) over(partition by pk) from t1; -> select c1 from t1;
rewrite func(para) over (partition by unique_keys) 1. func() is count(non-null) or rank/dense_rank/row_number -> 1 2. func(para) is min/max/sum/avg/first_value/last_value -> para e.g select max(c1) over(partition by pk) from t1; -> select c1 from t1;
…pache#37061) intro by apache#33647 after window expression rewritten by literal. literal's data type should same with original window expression.
rewrite func(para) over (partition by unique_keys)
e.g
select max(c1) over(partition by pk) from t1;
-> select c1 from t1;