starrocks
starrocks copied to clipboard
[Enhancement] Add GroupByCountDistinctRewriteRule
What type of PR is this:
- [ ] bug
- [ ] feature
- [x] enhancement
- [ ] refactor
- [ ] others
Which issues of this PR fixes :
Fixes #
Problem Summary(Required) :
Rewrite count(distinct xx) group by x when distinct columns satisfy scan distribution e.g. select count(distinct xx) from t group by x -> select count(xx) from (select x, xx from t group by x, xx) tt group by x;
Checklist:
- [ ] I have added test cases for my bug fix or my new feature
- [ ] I have added user document for my new feature or new function
run starrocks_fe_unittest
Please add the test case the benchmark framework.
run starrocks_fe_unittest
run starrocks_admit_test
run starrocks_admit_test
run starrocks_admit_test
run starrocks_admit_test
run starrocks_admit_test
run starrocks_fe_unittest
[FE PR Coverage Check]
:heart_eyes: pass : 102 / 102 (100.00%)
file detail
path | covered_line | new_line | coverage | not_covered_line_detail | |
---|---|---|---|---|---|
:large_blue_circle: | com/starrocks/sql/optimizer/Optimizer.java | 1 | 1 | 100.00% | [] |
:large_blue_circle: | com/starrocks/sql/optimizer/rule/transformation/RewriteMultiDistinctByCTERule.java | 3 | 3 | 100.00% | [] |
:large_blue_circle: | com/starrocks/sql/optimizer/rule/transformation/GroupByCountDistinctRewriteRule.java | 93 | 93 | 100.00% | [] |
:large_blue_circle: | com/starrocks/sql/optimizer/operator/logical/LogicalAggregationOperator.java | 4 | 4 | 100.00% | [] |
:large_blue_circle: | com/starrocks/sql/optimizer/rule/RuleType.java | 1 | 1 | 100.00% | [] |