[ 
https://issues.apache.org/jira/browse/IMPALA-7785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16669216#comment-16669216
 ] 

Philip Zeyliger commented on IMPALA-7785:
-----------------------------------------

Hi Paul!

I tried this on a recent (two weeks old?) build and didn't have any trouble:
{code}
[localhost:21000] default> select CASE WHEN string_col IS NOT NULL THEN 
string_col ELSE 'foo' END from functional.alltypes group by CASE WHEN 
string_col IS NOT NULL THEN string_col ELSE 'foo' END limit 1;
Query: select CASE WHEN string_col IS NOT NULL THEN string_col ELSE 'foo' END 
from functional.alltypes group by CASE WHEN string_col IS NOT NULL THEN 
string_col ELSE 'foo' END limit 1
Query submitted at: 2018-10-30 12:10:49 (Coordinator: http://12987a4df8d5:25000)
Query progress can be monitored at: 
http://12987a4df8d5:25000/query_plan?query_id=6346330a763f4efb:8773638300000000
+-----------------------------------------------------------------+
| case when string_col is not null then string_col else 'foo' end |
+-----------------------------------------------------------------+
| 8                                                               |
+-----------------------------------------------------------------+
Fetched 1 row(s) in 5.06s
{code}

Are you sure this isn't happening because of a change you have on your branch?

> 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 coalesce(string_col, 'foo')                                        
> FROM functional.alltypes                                                  
> GROUP BY coalesce(string_col, 'foo')                                         
> {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-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to