You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Alexander Behm (JIRA)" <ji...@apache.org> on 2017/08/21 18:57:01 UTC

[jira] [Resolved] (IMPALA-1423) Identifier in HAVING expr should fall back from SELECT item aliases to columns in FROM table refs

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

Alexander Behm resolved IMPALA-1423.
------------------------------------
    Resolution: Duplicate

This JIRA is about implementing SQL standard select-list alias substitution which is being discussed in more detail here IMPALA-5191.


> Identifier in HAVING expr should fall back from SELECT item aliases to columns in FROM table refs
> -------------------------------------------------------------------------------------------------
>
>                 Key: IMPALA-1423
>                 URL: https://issues.apache.org/jira/browse/IMPALA-1423
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 2.1, Impala 2.2
>            Reporter: casey
>            Priority: Minor
>              Labels: incompatibility, planner, ramp-up, sql-language
>
> Both Postgresql and Oracle accept the query below
> {noformat}
> Query: select COUNT(1) AS int_col FROM alltypestiny HAVING SUM(int_col) > 1
> ERROR: AnalysisException: null
> CAUSED BY: IllegalStateException: Failed analysis after expr substitution.
> CAUSED BY: AnalysisException: aggregate function must not contain aggregate parameters: sum(count(1))
> {noformat}
> It seems Impala uses the SELECT item alias then immediately aborts when that is not valid whereas Postgresql and Oracle fall back to the table column.
> Postgresql
> {noformat}
> functional=# SELECT COUNT(1) AS int_col FROM alltypestiny HAVING SUM(int_col) > 1;
>  int_col 
> ---------
>        8
> (1 row)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)