You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/10/30 22:02:00 UTC

[jira] [Reopened] (IMPALA-7785) GROUP BY clause cannot contain a CASE statement

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

Paul Rogers reopened IMPALA-7785:
---------------------------------

> GROUP BY clause cannot contain a CASE statement
> -----------------------------------------------
>
>                 Key: IMPALA-7785
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7785
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 3.0
>            Reporter: Paul Rogers
>            Priority: Minor
>
> The FE cannot handle a {{CASE}} statement in a {{GROUP BY}} clause. As a result, the change in IMPALA-7655 cannot be applied to queries with such a clause for fear of ending up in the situation shown later.
> Consider this simple query:
> {code:sql}
> SELECT case when string_col is not null then string_col else 'foo' end                                    
> FROM functional.alltypestiny                         
> GROUP BY case when string_col is not null then string_col else 'foo' end                                     
> {code}
> The above will fail with the following:
> {noformat}
>  org.apache.impala.common.AnalysisException:
>  select list expression not produced by aggregation output
>  (missing from GROUP BY clause?)    :
>  CASE WHEN string_col IS NOT NULL THEN string_col ELSE 'foo' END
> {noformat}
> This then causes the rewrites in IMPALA-7655 to fail:
> {code:sql}
> SELECT coalesce(string_col, 'foo')                                    
> FROM functional.alltypes                                                  
> GROUP BY coalesce(string_col, 'foo')                                         
> {code}
> The above is rewritten using the new conditional function rewrite rules. Result:
> {noformat}
> org.apache.impala.common.AnalysisException:
>   select list expression not produced by aggregation output
>   (missing from GROUP BY clause?):
>   CASE WHEN string_col IS NOT NULL THEN string_col ELSE 'foo' END
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org