You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Takahiko Saito (JIRA)" <ji...@apache.org> on 2016/01/13 02:20:39 UTC

[jira] [Updated] (HIVE-12778) Having with count distinct doesn't work for special combination

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

Takahiko Saito updated HIVE-12778:
----------------------------------
    Affects Version/s: 1.2.1

> Having with count distinct doesn't work for special combination
> ---------------------------------------------------------------
>
>                 Key: HIVE-12778
>                 URL: https://issues.apache.org/jira/browse/HIVE-12778
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 1.1.0, 1.2.1
>            Reporter: Peter Brejcak
>
> There is problem for combination of count(distinct ) in having clause without count(distinct ) in select clause. 
> First case returns error *FAILED: SemanticException [Error 10002]: Line Invalid column reference* (unexpected)
> If I add count(distinct ) to select clause result is ok (expected).
> Please run code to see it.
> Steps to reproduce:
> {code}
> create table table_subquery_having_problem (id int, value int);
> insert into table table_subquery_having_problem values (1,1);
> insert into table table_subquery_having_problem values (1,2);
> insert into table table_subquery_having_problem values (1,3);
> insert into table table_subquery_having_problem values (1,4);
> insert into table table_subquery_having_problem values (1,5);
> insert into table table_subquery_having_problem values (1,6);
> insert into table table_subquery_having_problem values (1,7);
> insert into table table_subquery_having_problem values (1,8);
> insert into table table_subquery_having_problem values (1,9);
> select x.id from table_subquery_having_problem x
> group by x.id
> having count(distinct x.value)>1;  -- result is ERROR
> select x.id, count(distinct x.value) from table_subquery_having_problem x
> group by x.id
> having count(distinct x.value)>1; --result is OK
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)