[
https://issues.apache.org/jira/browse/CALCITE-6201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jiajun Xie resolved CALCITE-6201.
---------------------------------
Resolution: Duplicate
> Merge Aggregate node if count distinct column has been deduplicated
> -------------------------------------------------------------------
>
> Key: CALCITE-6201
> URL: https://issues.apache.org/jira/browse/CALCITE-6201
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Jiajun Xie
> Assignee: Jiajun Xie
> Priority: Minor
>
> distinct column is redundant because count has distinct.
> {code:java}
> select count(distinct x) cnt
> from(
> select distinct sal x from emp
> ) t {code}
> PlanBefore is
> {noformat}
> LogicalAggregate(group=[{}], CNT=[COUNT(DISTINCT $0)])
> LogicalAggregate(group=[{5}])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]]){noformat}
> PlanAfter should be
> {noformat}
> LogicalAggregate(group=[{}], CNT=[COUNT(DISTINCT $5)])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]]){noformat}
> But `CoreRules.AGGREGATE_MERGE` not support it, we can improve it.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)