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

Julian Hyde commented on CALCITE-512:
-------------------------------------

I see you have assigned this to yourself. If you want to do this, you should 
start from my branch 
https://github.com/julianhyde/incubator-calcite/commit/f49276b6bab3115945f0952c4121c2dbd6da0a9e.
 Or assign it back to me.

The parsing and validation is done; we just need to translate to an expression 
involving indicator columns. {{SqlToRelConverter.lookupAggregates}} is probably 
where the work needs to be done. Run JdbcTest.testRunAgg (which calls agg.oq) 
and make sure the results look good.

{{GROUP_ID}} and {{GROUPING_ID}} should probably return a BIGINT, not INTEGER 
as at present. That will allow for 63 grouping expressions rather than 31.

What do you think should be the behavior if an argument to {{GROUPING_ID}} 
occurs multiple times, or if arguments are not in the same order as in the 
{{GROUP BY}} clause? I think we already handle the case where an argument to 
{{GROUPING_ID}} is not being grouped.

> Add GROUP_ID and GROUPING_ID functions
> --------------------------------------
>
>                 Key: CALCITE-512
>                 URL: https://issues.apache.org/jira/browse/CALCITE-512
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Jesus Camacho Rodriguez
>
> Implement GROUP_ID and GROUPING_ID(expr [, expr]...) functions, as they are 
> defined in Oracle.
> We already have, as of CALCITE-370, the GROUPING(expr) function. Now define 
> GROUPING_ID:
> GROUPING_ID(e2, e1, e0)
>  == GROUPING(e2) * 4 
>   + GROUPING(e1) * 2
>   + GROUPING(e0)
> and similarly for different numbers of arguments.
> GROUP_ID() is equivalent to GROUPING_ID(x, y, z), where x, y, z are the 
> expressions being grouped.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to