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

Jesus Camacho Rodriguez commented on CALCITE-2051:
--------------------------------------------------

bq. Do you acknowledge that it was a mistake for Hive to diverge from the 
standard and have a dual GROUP BY and GROUPING SETS clause?
It was a mistake indeed, that is out of question. The standard should have been 
followed from the onset. To be clear, when I started working on Hive, it was 
already there.

I just meant that the operator can be more flexible, we do not need to have a 
one-to-one correspondence between the SQL clause and the operator. Calcite 
currently does not exploit this flexibility at the algebraic representation 
level, but Hive does. This will only be relevant for projects that integrate at 
the algebraic level and do not use Calcite parser too.

However, if it is more convenient for the developer that the operator has 
exactly the same semantics as in SQL (less confusion), I am fine with that. I 
am just asking to enforce this at a new major release 2.0 instead of in 1.15. 
Maybe not adding the pre-condition was a bug from your perspective, but it gave 
us the expressive power needed to represent directly the semantics of the Hive 
group by operator.

If that is not possible, to lower the impact, I guess we can incorporate my 
patch to yours, i.e., take action in the rules depending on the Group type 
(SIMPLE), and include the _induce_ method in the Aggregate class so it can be 
overridden. That would give us a way to represent the semantics on our end 
without having the make changes to Hive parser for the time being.

> Rules using Aggregate might check for simple grouping sets incorrectly
> ----------------------------------------------------------------------
>
>                 Key: CALCITE-2051
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2051
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Jesus Camacho Rodriguez
>            Priority: Critical
>             Fix For: 1.15.0
>
>
> CALCITE-1069 removed the indicator columns for Aggregate operators. In some 
> places, the indicator boolean check was replaced by the following check: 
> {{aggregate.getGroupSets().size() > 1}}. However, that check is incomplete, 
> it should have been replaced by {{aggregate.getGroupType() != Group.SIMPLE}}.
> For instance : 
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/AggregateProjectMergeRule.java#L91



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to