-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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) Support to partition prune when query rewrite by sync materialized view #38527
[improvement](mtmv) Support to partition prune when query rewrite by sync materialized view #38527
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: 41617 ms
|
TPC-DS: Total hot run time: 169620 ms
|
ClickBench: Total hot run time: 30.18 s
|
indexId, | ||
PreAggStatus.unset(), | ||
preAggStatus, |
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.
should be unset
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 preAggStatus is variable.
it's is unset
when sync materialization context and is on
when async materialization context
return scanPlan; | ||
} | ||
if (queryStructInfo.getRelations().size() == 1 | ||
&& queryStructInfo.getRelations().get(0) instanceof LogicalOlapScan |
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.
refer to org.apache.doris.nereids.rules.rewrite.DeferMaterializeTopNResult
, maybe relation could be LogicalDeferMaterializeOlapScan
? can we collect correct struct info?
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.
Yeah, we can collect the LogicalDeferMaterializeOlapScan
when collect the struct info
private static class RelationCollector extends DefaultPlanVisitor<Void, List<CatalogRelation>> {
@Override
public Void visit(Plan plan, List<CatalogRelation> collectedRelations) {
if (plan instanceof CatalogRelation) {
collectedRelations.add((CatalogRelation) plan);
}
return super.visit(plan, collectedRelations);
}
}
run buildall |
TPC-H: Total hot run time: 41922 ms
|
TPC-DS: Total hot run time: 170203 ms
|
ClickBench: Total hot run time: 29.95 s
|
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
…sync materialized view (apache#38527) Support to partition prune when query rewrite by sync materialized view such as table def is as following: ```sql CREATE TABLE IF NOT EXISTS test_unique ( `time` DATETIME NULL COMMENT '查询时间', `app_name` VARCHAR(64) NULL COMMENT '标识', `event_id` VARCHAR(128) NULL COMMENT '标识', `decision` VARCHAR(32) NULL COMMENT '枚举值', `id` VARCHAR(35) NOT NULL COMMENT 'od', `code` VARCHAR(64) NULL COMMENT '标识', `event_type` VARCHAR(32) NULL COMMENT '事件类型' ) UNIQUE KEY(time) PARTITION BY RANGE(time) ( FROM ("2024-07-01 00:00:00") TO ("2024-07-15 00:00:00") INTERVAL 1 HOUR ) DISTRIBUTED BY HASH(time) BUCKETS 3 PROPERTIES ("replication_num" = "1"); ``` sync materialized view def is ```sql create materialized view as select app_name, event_id, time, count(*) from test_duplicate group by app_name, event_id, time; ``` if your query is following, if rewritten by sync materialized view successfully, should partition prune ```sql select app_name, event_id, time, count(*) from test_duplicate where time < '2024-07-05 01:00:00' group by app_name, time, event_id; ```
…sync materialized view (#38527) ## Proposed changes Support to partition prune when query rewrite by sync materialized view such as table def is as following: ```sql CREATE TABLE IF NOT EXISTS test_unique ( `time` DATETIME NULL COMMENT '查询时间', `app_name` VARCHAR(64) NULL COMMENT '标识', `event_id` VARCHAR(128) NULL COMMENT '标识', `decision` VARCHAR(32) NULL COMMENT '枚举值', `id` VARCHAR(35) NOT NULL COMMENT 'od', `code` VARCHAR(64) NULL COMMENT '标识', `event_type` VARCHAR(32) NULL COMMENT '事件类型' ) UNIQUE KEY(time) PARTITION BY RANGE(time) ( FROM ("2024-07-01 00:00:00") TO ("2024-07-15 00:00:00") INTERVAL 1 HOUR ) DISTRIBUTED BY HASH(time) BUCKETS 3 PROPERTIES ("replication_num" = "1"); ``` sync materialized view def is ```sql create materialized view as select app_name, event_id, time, count(*) from test_duplicate group by app_name, event_id, time; ``` if your query is following, if rewritten by sync materialized view successfully, should partition prune ```sql select app_name, event_id, time, count(*) from test_duplicate where time < '2024-07-05 01:00:00' group by app_name, time, event_id; ```
Proposed changes
Support to partition prune when query rewrite by sync materialized view
such as table def is as following:
sync materialized view def is
if your query is following, if rewritten by sync materialized view successfully, should partition prune