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

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

Aman Sinha created HIVE-26534:
---------------------------------

             Summary: 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


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)