-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[improvement](mtmv) Not roll up when aggregate rewrite if roll up group by expr is uniform #38387
[improvement](mtmv) Not roll up when aggregate rewrite if roll up group by expr is uniform #38387
Conversation
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
fc43885
to
e7daa9b
Compare
run buildall |
TPC-H: Total hot run time: 39836 ms
|
TPC-DS: Total hot run time: 173031 ms
|
ClickBench: Total hot run time: 30.69 s
|
run buildall |
c0d00e1
to
76826d4
Compare
run buildall |
TPC-H: Total hot run time: 39631 ms
|
TPC-DS: Total hot run time: 174074 ms
|
ClickBench: Total hot run time: 31.17 s
|
…up by expr is uniform
…up by expr is uniform
76826d4
to
85e33b0
Compare
run buildall |
TPC-H: Total hot run time: 42106 ms
|
TPC-DS: Total hot run time: 170248 ms
|
ClickBench: Total hot run time: 30.01 s
|
if (materializationContext instanceof SyncMaterializationContext) { | ||
return false; | ||
} |
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 comment for this if statement
} | ||
|
||
/** | ||
* Check group by is equal or not after group by eliminate |
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 comment of isGroupByEqualsAfterEqualFilterEliminate is easy to understand, but not isGroupByEqualsAfterGroupByEliminate, can we improve that?
run buildall |
run buildall |
TPC-H: Total hot run time: 41561 ms
|
TPC-DS: Total hot run time: 168678 ms
|
ClickBench: Total hot run time: 29.88 s
|
run buildall |
TPC-H: Total hot run time: 41321 ms
|
TPC-DS: Total hot run time: 169713 ms
|
ClickBench: Total hot run time: 30.05 s
|
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
…up by expr is uniform (#38387) ## Proposed changes Not roll up when aggregate rewrite if roll up group by expr is uniform Such as mv name is mv3_0, and def is: ```sql CREATE MATERIALIZED VIEW mv3_0 BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ('replication_num' = '1') AS select o_orderdate, o_shippriority, o_comment, sum(o_totalprice) as sum_total, max(o_totalprice) as max_total, min(o_totalprice) as min_total, count(*) as count_all from orders group by o_orderdate, o_shippriority, o_comment; ``` query sql is as following: ```sql select o_comment, sum(o_totalprice), max(o_totalprice), min(o_totalprice), count(*) from orders where o_orderdate = '2023-12-09' and o_shippriority = 1 group by o_comment; ``` after rewrite the plan is as following, not need to add aggregate ``` PhysicalResultSink --filter((mv3_0.o_orderdate = '2023-12-09') and (mv3_0.o_shippriority = 1)) ----PhysicalOlapScan[mv3_0] ```
…up by expr is uniform (apache#38387) ## Proposed changes Not roll up when aggregate rewrite if roll up group by expr is uniform Such as mv name is mv3_0, and def is: ```sql CREATE MATERIALIZED VIEW mv3_0 BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ('replication_num' = '1') AS select o_orderdate, o_shippriority, o_comment, sum(o_totalprice) as sum_total, max(o_totalprice) as max_total, min(o_totalprice) as min_total, count(*) as count_all from orders group by o_orderdate, o_shippriority, o_comment; ``` query sql is as following: ```sql select o_comment, sum(o_totalprice), max(o_totalprice), min(o_totalprice), count(*) from orders where o_orderdate = '2023-12-09' and o_shippriority = 1 group by o_comment; ``` after rewrite the plan is as following, not need to add aggregate ``` PhysicalResultSink --filter((mv3_0.o_orderdate = '2023-12-09') and (mv3_0.o_shippriority = 1)) ----PhysicalOlapScan[mv3_0] ```
Proposed changes
Not roll up when aggregate rewrite if roll up group by expr is uniform
Such as mv name is mv3_0, and def is:
query sql is as following:
after rewrite the plan is as following, not need to add aggregate