924060929 opened a new pull request, #36128:
URL: https://github.com/apache/doris/pull/36128
## Proposed changes
Backend can process distinct aggregate by two method:
1. use group by key to process distinct, I call it: external distinct of
aggregate function
2. use `multi_distinct_xxx` to process distinct, in the corresponding
aggregate function, I call it: internal distinct of aggregate function
This sql should process distinct by the multi distinct function when use
four phase aggregation:
The first two phase use group by key: id, field1 and field2.
The last two phase use group by key: id. the group by key can not process
distinct in the aggregate function, so we should use internal distinct method
in four phase aggregate function, if contains multi distinct column(e.g. field1
and field2)
```sql
select
/*+SET_VAR(disable_nereids_rules='TWO_PHASE_AGGREGATE_SINGLE_DISTINCT_TO_MULTI,TWO_PHASE_AGGREGATE_WITH_MULTI_DISTINCT,THREE_PHASE_AGGREGATE_WITH_DISTINCT,THREE_PHASE_AGGREGATE_WITH_COUNT_DISTINCT_MULTI')*/
id,
count(distinct field1),
count(distinct field2)
from agg_4_phase_tbl2
group by id
order by id
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]