starrocks icon indicating copy to clipboard operation
starrocks copied to clipboard

[Enhancement] Add GroupByCountDistinctRewriteRule

Open Seaven opened this issue 1 year ago • 4 comments

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

Seaven avatar Aug 10 '22 08:08 Seaven

run starrocks_fe_unittest

Seaven avatar Aug 11 '22 12:08 Seaven

Please add the test case the benchmark framework.

kangkaisen avatar Aug 12 '22 07:08 kangkaisen

run starrocks_fe_unittest

Seaven avatar Aug 15 '22 02:08 Seaven

run starrocks_admit_test

wanpengfei-git avatar Aug 16 '22 06:08 wanpengfei-git

run starrocks_admit_test

wanpengfei-git avatar Aug 16 '22 10:08 wanpengfei-git

run starrocks_admit_test

Seaven avatar Aug 16 '22 11:08 Seaven

run starrocks_admit_test

wanpengfei-git avatar Aug 17 '22 02:08 wanpengfei-git

run starrocks_admit_test

wanpengfei-git avatar Aug 17 '22 03:08 wanpengfei-git

run starrocks_fe_unittest

Seaven avatar Aug 17 '22 05:08 Seaven

[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% []

wanpengfei-git avatar Aug 17 '22 06:08 wanpengfei-git