You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Aman Sinha (Jira)" <ji...@apache.org> on 2022/09/14 17:49:00 UTC

[jira] [Resolved] (HIVE-26534) GROUPING() function errors out due to case-sensitivity of function name

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

Aman Sinha resolved HIVE-26534.
-------------------------------
    Resolution: Fixed

Marking this fixed since [~soumyakanti.das] PR has been merged.

> GROUPING() function errors out due to case-sensitivity of function name
> -----------------------------------------------------------------------
>
>                 Key: HIVE-26534
>                 URL: https://issues.apache.org/jira/browse/HIVE-26534
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive, Logical Optimizer
>            Reporter: Aman Sinha
>            Assignee: Soumyakanti Das
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> The following errors out:
> {noformat}
> explain cbo select GROUPING(l_suppkey) from lineitem group by l_suppkey with rollup;
> Error: Error while compiling statement: FAILED: SemanticException [Error 10015]: Line 1:19 Arguments length mismatch 'l_suppkey': grouping() requires at least 2 argument, got 1 (state=21000,code=10015)
> {noformat}
> Lowercase grouping() succeeds:
> {noformat}
> explain cbo select grouping(l_suppkey) from lineitem group by l_suppkey with rollup;
> +----------------------------------------------------+
> |                      Explain                       |
> +----------------------------------------------------+
> | CBO PLAN:                                          |
> | HiveProject(_o__c0=[grouping($1, 0:BIGINT)])       |
> |   HiveAggregate(group=[{0}], groups=[[{0}, {}]], GROUPING__ID=[GROUPING__ID()]) |
> |     HiveProject(l_suppkey=[$2])                    |
> |       HiveTableScan(table=[[tpch, lineitem]], table:alias=[lineitem]) |
> |                                                    |
> +----------------------------------------------------+
> {noformat}
> This is likely due to the SemanticAnalyzer doing a case-sensitive compare here:
> {noformat}
>  @Override
>       public Object post(Object t) {
>          ....
>           if (func.getText().equals("grouping") && func.getChildCount() == 0) {
> {noformat}
> We should fix this to make it case-insensitive comparison.  There might be other places to examine too for grouping function.



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