Jiajun Xie created CALCITE-6201: ----------------------------------- Summary: 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
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)