-
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
[fix](nereids) Use correct PREAGGREGATION in agg(filter(scan)) #33454
Conversation
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
@BiteTheDDDDt hello, do you have time to see this pr? |
run buildall |
String childNameWithFuncName = ctx.isBaseIndex() | ||
? normalizeName(aggFunc.child(0).toSql()) | ||
: normalizeName(CreateMaterializedViewStmt.mvColumnBuilder( | ||
matchingAggType, normalizeName(aggFunc.child(0).toSql()))); | ||
|
||
boolean contains = containsAllColumn(aggFunc.child(0), ctx.keyNameToColumn.keySet()); | ||
if (contains || ctx.keyNameToColumn.containsKey(childNameWithFuncName)) { | ||
if (ctx.isDupKeysOrMergeOnWrite || (!ctx.isBaseIndex() && contains)) { | ||
if (canUseKeyColumn || ctx.isDupKeysOrMergeOnWrite || (!ctx.isBaseIndex() && contains)) { |
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.
maybe we can use ctx.isBaseIndex() to replace canUseKeyColumn?
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.
It doesn't seem to work.
...ain/java/org/apache/doris/nereids/rules/rewrite/mv/SelectMaterializedIndexWithAggregate.java
Show resolved
Hide resolved
run feut |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
run buildall |
run buildall |
PR approved by at least one committer and no changes requested. |
run buildall |
TPC-H: Total hot run time: 38325 ms
|
TPC-DS: Total hot run time: 183712 ms
|
ClickBench: Total hot run time: 30.28 s
|
Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
|
@morrySnow Hi, Wenxin. This PR is ready for merge. Do you have time to have a look at it? |
} | ||
|
||
qt_right_when_preagg_on "select k1, min(k2), max(k3) from test_scan_preaggregation where k1 = 1 group by k1;" | ||
qt_right_when_preagg_off "select k1, sum(v1) from test_scan_preaggregation group by k1;" |
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.
qt_right_when_preagg_off is misleading, the preagg should be on ? and please use explain to verify the preagg status
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.
Sorry, I was originally going to test aggregation on key columns. I modified the test sql.
run buildall |
TPC-H: Total hot run time: 38509 ms
|
TPC-DS: Total hot run time: 183093 ms
|
ClickBench: Total hot run time: 30.41 s
|
Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
|
@starocean999 Hi, I fix the regression test case, can you take another look at this PR? |
PR approved by at least one committer and no changes requested. |
1. set `PreAggStatus` to `ON` when agg key column by max or min; 2. #28747 may change `PreAggStatus` of scan, inherit it from the previous one.
1. set `PreAggStatus` to `ON` when agg key column by max or min; 2. #28747 may change `PreAggStatus` of scan, inherit it from the previous one.
1. set `PreAggStatus` to `ON` when agg key column by max or min; 2. #28747 may change `PreAggStatus` of scan, inherit it from the previous one.
Proposed changes
Issue Number: close #33351
PreAggStatus
toON
when agg key column by max or min;PreAggStatus
of scan, inherit it from the previous one.Further comments
Further regression test case will be conducted later.