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

Julian Hyde commented on CALCITE-4748:
--------------------------------------

After CALCITE-1824, we apply {{RelBuilder.rewriteAggregateWithGroupId}} only 
when there is a call to the {{GROUP_ID}} function. I think we need to apply the 
same logic if there are duplicate grouping sets, even if {{GROUP_ID}} is not 
present.

> duplicate columnName in grouping sets get the wrong result
> ----------------------------------------------------------
>
>                 Key: CALCITE-4748
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4748
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.27.0
>            Reporter: duan xiong
>            Assignee: duan xiong
>            Priority: Critical
>
> When run SQL1:
> {code:java}
> select prod_id from foodmart.sales_fact_1997 as s group by grouping 
> sets(prod_id,prod_id){code}
> and SQL2:
> {code:java}
> select prod_id from foodmart.sales_fact_1997 as s group by grouping 
> sets(prod_id){code}
> get the SAME result. This is wrong. SQL1 return result's number = SQL2 return 
> result*2 number



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to