[ 
https://issues.apache.org/jira/browse/CALCITE-5525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jiajun Xie updated CALCITE-5525:
--------------------------------
    Labels: newbie  (was: easy-fix)

> GROUPING_ID() should be rewritten to GROUPING() for some dialects in 
> RelToSqlConverter
> --------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5525
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5525
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jiajun Xie
>            Assignee: Jiajun Xie
>            Priority: Minor
>              Labels: newbie
>
> Some databases not exists `grouping_id()`, `grouping()` is used as 
> `grouping_id()`.
>  - Postgresql
> {code:java}
> ERROR:  function grouping_id(integer, character varying) does not exist
> LINE 1: select grouping(id), grouping(name), grouping_id(id, name), ...
>                                              ^
> HINT:  No function matches the given name and argument types. You might need 
> to add explicit type casts
> {code}
>  - Presto
> {code:java}
> Function grouping_id not registered
> {code}
>  
> Here is a simple query, `grouping_id()` is a legal function in Spark.
> {code:java}
> select  a,
>         b,
>         count(*),
>         grouping(a) ga,
>         grouping(b) gb,
>         grouping_id(a, b)
> from    (
>             select  1 as a, 2 as b
>         )
> group by grouping sets((a, b), (b), ())
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to