You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jiajun Xie (Jira)" <ji...@apache.org> on 2023/02/10 09:41:00 UTC

[jira] [Updated] (CALCITE-5525) GROUPING_ID() should be rewritten to GROUPING() for some dialects in RelToSqlConverter

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

Jiajun Xie updated CALCITE-5525:
--------------------------------
    Summary: GROUPING_ID() should be rewritten to GROUPING() for some dialects in RelToSqlConverter  (was: GROUPING_ID() should be rewritten to GROUPING() in some dialects)

> 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
>
> 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)