-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[feature](mtmv) Support query rewrite by materialized view when query is aggregate and materialized view has no aggregate #36278
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
Merged
starocean999
merged 2 commits into
apache:master
from
seawinde:support_query_rewrite_by_mv_when_aggregate_on_scan
Jun 14, 2024
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… is aggregate and materialized view has no aggregate
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
Contributor
Author
|
run buildall |
TPC-H: Total hot run time: 39747 ms |
TPC-DS: Total hot run time: 173488 ms |
ClickBench: Total hot run time: 30.1 s |
starocean999
approved these changes
Jun 14, 2024
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
keanji-x
approved these changes
Jun 14, 2024
dataroaring
pushed a commit
that referenced
this pull request
Jun 17, 2024
…y is aggregate and materialized view has no aggregate (#36278) ## Proposed changes Support query rewrite by materialized view when query is aggregate and materialized view has no aggregate this maybe improve query spped, because it can save expression evaluation by use the expression result in materialized view. this also support single table rewrite. For example as follwoing: mv def is: > CREATE MATERIALIZED VIEW mv1 > BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ('replication_num' = '1') > AS > select case when o_shippriority > 1 and o_orderkey IN (4, 5) then o_custkey else o_shippriority end, > o_orderstatus, > bin(o_orderkey), > l_suppkey, > l_linenumber > from orders > left join lineitem on o_orderkey = l_orderkey; the query as following can be rewritten by mv successfully > select > count(case when o_shippriority > 1 and o_orderkey IN (4, 5) then o_custkey else o_shippriority end) as count_case, > o_orderstatus, > bin(o_orderkey) > from orders > left join lineitem on o_orderkey = l_orderkey > where l_linenumber = 4 > group by > o_orderstatus, > bin(o_orderkey);
seawinde
added a commit
to seawinde/doris
that referenced
this pull request
Jun 20, 2024
…y is aggregate and materialized view has no aggregate (apache#36278) ## Proposed changes Support query rewrite by materialized view when query is aggregate and materialized view has no aggregate this maybe improve query spped, because it can save expression evaluation by use the expression result in materialized view. this also support single table rewrite. For example as follwoing: mv def is: > CREATE MATERIALIZED VIEW mv1 > BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ('replication_num' = '1') > AS > select case when o_shippriority > 1 and o_orderkey IN (4, 5) then o_custkey else o_shippriority end, > o_orderstatus, > bin(o_orderkey), > l_suppkey, > l_linenumber > from orders > left join lineitem on o_orderkey = l_orderkey; the query as following can be rewritten by mv successfully > select > count(case when o_shippriority > 1 and o_orderkey IN (4, 5) then o_custkey else o_shippriority end) as count_case, > o_orderstatus, > bin(o_orderkey) > from orders > left join lineitem on o_orderkey = l_orderkey > where l_linenumber = 4 > group by > o_orderstatus, > bin(o_orderkey);
seawinde
added a commit
to seawinde/doris
that referenced
this pull request
Jul 8, 2024
…y is aggregate and materialized view has no aggregate (apache#36278) ## Proposed changes Support query rewrite by materialized view when query is aggregate and materialized view has no aggregate this maybe improve query spped, because it can save expression evaluation by use the expression result in materialized view. this also support single table rewrite. For example as follwoing: mv def is: > CREATE MATERIALIZED VIEW mv1 > BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ('replication_num' = '1') > AS > select case when o_shippriority > 1 and o_orderkey IN (4, 5) then o_custkey else o_shippriority end, > o_orderstatus, > bin(o_orderkey), > l_suppkey, > l_linenumber > from orders > left join lineitem on o_orderkey = l_orderkey; the query as following can be rewritten by mv successfully > select > count(case when o_shippriority > 1 and o_orderkey IN (4, 5) then o_custkey else o_shippriority end) as count_case, > o_orderstatus, > bin(o_orderkey) > from orders > left join lineitem on o_orderkey = l_orderkey > where l_linenumber = 4 > group by > o_orderstatus, > bin(o_orderkey);
seawinde
added a commit
to seawinde/doris
that referenced
this pull request
Jul 10, 2024
…y is aggregate and materialized view has no aggregate (apache#36278) ## Proposed changes Support query rewrite by materialized view when query is aggregate and materialized view has no aggregate this maybe improve query spped, because it can save expression evaluation by use the expression result in materialized view. this also support single table rewrite. For example as follwoing: mv def is: > CREATE MATERIALIZED VIEW mv1 > BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ('replication_num' = '1') > AS > select case when o_shippriority > 1 and o_orderkey IN (4, 5) then o_custkey else o_shippriority end, > o_orderstatus, > bin(o_orderkey), > l_suppkey, > l_linenumber > from orders > left join lineitem on o_orderkey = l_orderkey; the query as following can be rewritten by mv successfully > select > count(case when o_shippriority > 1 and o_orderkey IN (4, 5) then o_custkey else o_shippriority end) as count_case, > o_orderstatus, > bin(o_orderkey) > from orders > left join lineitem on o_orderkey = l_orderkey > where l_linenumber = 4 > group by > o_orderstatus, > bin(o_orderkey);
morrySnow
pushed a commit
that referenced
this pull request
Jul 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
approved
Indicates a PR has been approved by one committer.
dev/2.1.5-merged
dev/3.0.0-merged
reviewed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
Support query rewrite by materialized view when query is aggregate and materialized view has no aggregate
this maybe improve query spped, because it can save expression evaluation by use the expression result in materialized view.
this also support single table rewrite.
For example as follwoing:
mv def is:
the query as following can be rewritten by mv successfully