[
https://issues.apache.org/jira/browse/CALCITE-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14239941#comment-14239941
]
Jesus Camacho Rodriguez edited comment on CALCITE-512 at 12/9/14 7:48 PM:
--------------------------------------------------------------------------
Sorry [~julianhyde], I thought you had not started working on this (I did not
see the status change in the ticket), so I was going to take care of it. Then
maybe it is easier that you finish it, and I continue working on CALCITE-461?
Your call.
About your questions:
- If an argument to {{GROUPING_ID}} appears multiple times (I don't know why
somebody would want that), I guess there are two approaches: \(i) throw an
error, or (ii) allow it (and maybe throw a warning?). I support the second
approach, so the user should have freedom to use it his own way.
- I think for the {{GROUPING_ID}} function, we should only take into account
its parameters and their order. Thus, as you stated:
{noformat}
GROUPING_ID(e2, e1, e0)
== GROUPING(e2) * 4
+ GROUPING(e1) * 2
+ GROUPING(e0)
{noformat}
independently of whether we have grouped by e.g. {{e2, e1, e0}} or {{e1, e2,
e0}}.
{quote}
I think we already handle the case where an argument to {{GROUPING_ID}} is not
being grouped.
{quote}
What do you mean? Do you throw an error, or...?
was (Author: jcamachorodriguez):
Sorry [~julianhyde], I thought you had not started working on this (I did not
see the status change in the ticket), so I was going to take care of it. Then
maybe it is easier that you finish it, and I continue working on CALCITE-461?
Your call.
About your questions:
- If an argument to {{GROUPING_ID}} appears multiple times (I don't know why
somebody would want that), I guess there are two approaches: (i) throw an
error, or (ii) allow it (and maybe throw a warning?). I support the second
approach, so the user should have freedom to use it his own way.
- I think for the {{GROUPING_ID}} function, we should only take into account
its parameters and their order. Thus, as you stated:
{noformat}
GROUPING_ID(e2, e1, e0)
== GROUPING(e2) * 4
+ GROUPING(e1) * 2
+ GROUPING(e0)
{noformat}
independently of whether we have grouped by e.g. {{e2, e1, e0}} or {{e1, e2,
e0}}.
{quote}
I think we already handle the case where an argument to {{GROUPING_ID}} is not
being grouped.
{quote}
What do you mean? Do you throw an error, or...?
> 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)