[fix](nereids) Refine aggregate shuffle-key reuse safety checks - #64892
[fix](nereids) Refine aggregate shuffle-key reuse safety checks#64892foxtail463 wants to merge 5 commits into
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
TPC-H: Total hot run time: 29420 ms |
TPC-DS: Total hot run time: 171785 ms |
019cd1b to
2de423e
Compare
ClickBench: Total hot run time: 25.24 s |
|
run buildall |
TPC-H: Total hot run time: 28727 ms |
TPC-DS: Total hot run time: 171183 ms |
ClickBench: Total hot run time: 25.15 s |
FE Regression Coverage ReportIncrement line coverage |
morrySnow
left a comment
There was a problem hiding this comment.
Thanks for this fix! The change from default-true to default-false in shouldUseParent when stats are missing is the right safety trade-off — preventing OOM is much more important than a potentially narrower shuffle. The approach of pre-resolving parent hash expressions against group-by expressions in visitPhysicalHashAggregate also simplifies shouldUseParent nicely.
I left a few inline comments for your consideration.
| physicalHashAggregate( | ||
| physicalDistribute(any())))), | ||
| physicalDistribute( | ||
| physicalHashAggregate( |
There was a problem hiding this comment.
The physicalDistribute wrappers are now expected in the plan shape because shouldUseParent no longer returns true when stats are unknown (which is the case in this unit test). Previously, the parent subset key was blindly adopted, which could eliminate the distribute node. This test change correctly reflects the stricter stats gate — the full group-by key distribution is used, and the distribute is preserved.
This is an intended side effect of the fix, but worth confirming: is the plan shape here what you would expect to see in production queries after this change?
|
run buildall |
FE UT Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 29567 ms |
TPC-DS: Total hot run time: 180211 ms |
ClickBench: Total hot run time: 24.95 s |
FE Regression Coverage ReportIncrement line coverage |
b41acce to
06375c3
Compare
|
run buildall |
TPC-H: Total hot run time: 29222 ms |
TPC-DS: Total hot run time: 168818 ms |
ClickBench: Total hot run time: 23.71 s |
FE Regression Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 16819 ms |
TPC-DS: Total hot run time: 83970 ms |
ClickBench: Total hot run time: 17.48 s |
|
run buildall |
TPC-H: Total hot run time: 17071 ms |
TPC-DS: Total hot run time: 86176 ms |
ClickBench: Total hot run time: 17.74 s |
|
run buildall |
TPC-H: Total hot run time: 16872 ms |
TPC-DS: Total hot run time: 84387 ms |
ClickBench: Total hot run time: 17.71 s |
|
run buildall |
ec8f139 to
1ad9237
Compare
|
run buildall |
TPC-H: Total hot run time: 17012 ms |
TPC-DS: Total hot run time: 84162 ms |
ClickBench: Total hot run time: 17.49 s |
FE Regression Coverage ReportIncrement line coverage |
|
run cloud_p0 |
FE Regression Coverage ReportIncrement line coverage |
1ad9237 to
d6c8d18
Compare
|
run buildall |
TPC-H: Total hot run time: 17027 ms |
TPC-DS: Total hot run time: 85522 ms |
ClickBench: Total hot run time: 17.68 s |
Refine aggregate shuffle-key reuse across property derivation,
child-property regulation, final-plan pruning, and translation.
Reuse parent shuffle keys when statistics indicate a balanced
distribution, while rejecting low-cardinality or skewed subsets and
falling back to the full aggregate keys when necessary.
Keep the safety policy consistent across planning stages while
preserving existing distribution and aggregate-stage semantics.