Support complete `distinct` usage for aggregate expressions
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
Here are multiple aggregate expressions have not support `distinct` usage yet.
Though optimizer `SingleDistinctToGroupBy` (#1315) supports single distinct usage, there are more SQL scenes have not been covered, like
```
SELECT AVG(c1), SUM(DISTINCT c2) FROM test
```
I would like to take effort to work on the following tickets to complete `distinct` usage for aggregate expressions
- [x] #2405
- [x] #2407
- [x] #2408
- [x] #2409
- [x] #2410
- [x] #2411
(more to be added later)
**Describe the solution you'd like**
Adds specific aggregate expression support, like `expressions::DistinctSum` for `sum(distinct)`
**Describe alternatives you've considered**
No.
**Additional context**
No.
Contributor guide
Research direction
Start by reading the SingleDistinctToGroupBy optimizer work referenced in #1315 and the aggregate-expression tickets #2405 and #2407–#2411. Use the mixed AVG(c1), SUM(DISTINCT c2) query as the initial case; done means the listed distinct aggregate-expression scenarios are supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- data-engineering, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100