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

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

Thanks for the help. I think it's fairly straightforward, building on work I 
did for {{GROUPING(e)}} - I abstracted a base class from SqlGroupingFunction 
and it has most of the functionality required to validate these new functions.

It's a shame, and confusing, that Hive's functions are not compatible with 
Oracle's. Hive's {{GROUPING__ID()}} (why two underscores?!) is similar to 
Oracle's {{GROUP_ID()}}, but there's nothing like Oracle's {{GROUPING_ID(e [, 
e]...)}}.



> 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: Julian Hyde
>
> 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