You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Zoltán Borók-Nagy (JIRA)" <ji...@apache.org> on 2018/01/26 12:57:00 UTC
[jira] [Closed] (IMPALA-5191) Behavior of GROUP BY, HAVING, ORDER
BY with column aliases should be more standard conforming
[ https://issues.apache.org/jira/browse/IMPALA-5191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zoltán Borók-Nagy closed IMPALA-5191.
-------------------------------------
Resolution: Fixed
Fix Version/s: Impala 3.0
Fixed in https://github.com/apache/impala/commit/545e60f8329ddd98b5adaff5981b52bbdcf4d69d
> Behavior of GROUP BY, HAVING, ORDER BY with column aliases should be more standard conforming
> ---------------------------------------------------------------------------------------------
>
> Key: IMPALA-5191
> URL: https://issues.apache.org/jira/browse/IMPALA-5191
> Project: IMPALA
> Issue Type: Bug
> Components: Frontend
> Reporter: Adriano
> Assignee: Zoltán Borók-Nagy
> Priority: Major
> Labels: incompatibility, ramp-up, sql-language
> Fix For: Impala 3.0
>
>
> Allow Impala to accept "column alias" and "Column name" indistinctly in the group by clause (also if Column is made by a function).
> We are confident that this can contribute to the growing of this Engine.
> This is a sample of a statement that we would like to execute with success:
> {noformat}
> with w_test as
> (select '1' as one,
> 2 as two,
> '3' as three)
> select one as one,
> substring(cast(two as string), 1, 1) as two,
> three as three,
> count(1) as cnt
> from w_test
> group by one,
> substring(cast(two as string), 1, 1),
> three
> ERROR: AnalysisException: select list expression not produced by aggregation output (missing from GROUP BY clause?): substring(CAST(two AS STRING), 1, 1)
> {noformat}
> It works writing the statements as:
> *workaround.1:*
> {noformat}
> with w_test as
> (select '1' as one,
> 2 as two,
> '3' as three)
> select one,
> substring(cast(two as string), 1, 1),
> three,
> count(1)
> from w_test
> group by one,
> substring(cast(two as string), 1, 1),
> three
> {noformat}
> *workaround.2:*
> {noformat}
> with w_test as
> (select '1' as one,
> 2 as two,
> '3' as three)
> select one as one,
> substring(cast(two as string), 1, 1) as two,
> three as three,
> count(1) as cnt
> from w_test
> group by 1,
> 2,
> 3
> {noformat}
> *workaround 3:*
> {noformat}
> with w_test as
> (select '1' as one,
> 2 as two,
> '3' as three)
> select one as t_one,
> substring(cast(two as string), 1, 1) as t_two,
> three as t_three,
> count(1) as cnt
> from w_test
> group by t_one,
> t_two,
> t_three
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)