[jira] [Commented] (CALCITE-6201) Merge Aggregate node if count distinct column has been deduplicated

2024-04-22 Thread Sergey Nuyanzin (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17839705#comment-17839705
 ] 

Sergey Nuyanzin commented on CALCITE-6201:
--

added fix version as it suggested to have it even for duplicates
https://calcite.apache.org/docs/howto.html#making-a-snapshot

> 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
> Fix For: 1.37.0
>
>
> 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)


[jira] [Commented] (CALCITE-6201) Merge Aggregate node if count distinct column has been deduplicated

2024-01-21 Thread Jiajun Xie (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17809092#comment-17809092
 ] 

Jiajun Xie commented on CALCITE-6201:
-

Remove `DISTINCT` in count is a better solution.

So I create https://issues.apache.org/jira/browse/CALCITE-6214

> 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)