You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Naresh P R (Jira)" <ji...@apache.org> on 2023/11/15 22:50:00 UTC

[jira] [Updated] (HIVE-27876) Incorrect query results on tables with ClusterBy & SortBy

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

Naresh P R updated HIVE-27876:
------------------------------
    Description: 
Repro:

 
{code:java}
create external table test_bucket(age int, name string, dept string) clustered by (age, name) sorted by (age asc, name asc) into 2 buckets stored as orc;
insert into test_bucket values (1, 'user1', 'dept1'), ( 2, 'user2' , 'dept2');
insert into test_bucket values (1, 'user1', 'dept1'), ( 2, 'user2' , 'dept2');

//empty wrong results
select age, name, count(*) from test_bucket group by  age, name having count(*) > 1; 
+------+-------+------+
| age  | name  | _c2  |
+------+-------+------+
+------+-------+------+

// Workaround
set hive.map.aggr=false;
select age, name, count(*) from test_bucket group by  age, name having count(*) > 1; 
+------+--------+------+
| age  |  name  | _c2  |
+------+--------+------+
| 1    | user1  | 2    |
| 2    | user2  | 2    |
+------+--------+------+ {code}
 

 

  was:
Repro:

 
{code:java}
create external table test_bucket(age int, name string, dept string) clustered by (age, name) sorted by (age asc, name asc) into 2 buckets stored as orc;
insert into test_bucket values (1, 'user1', 'dept1'), ( 2, 'user2' , 'dept2');
insert into test_bucket values (1, 'user1', 'dept1'), ( 2, 'user2' , 'dept2');

//empty wrong results with default CDP configs
select age, name, count(*) from test_bucket group by  age, name having count(*) > 1; 
+------+-------+------+
| age  | name  | _c2  |
+------+-------+------+
+------+-------+------+

// Workaround
set hive.map.aggr=false;
select age, name, count(*) from test_bucket group by  age, name having count(*) > 1; 
+------+--------+------+
| age  |  name  | _c2  |
+------+--------+------+
| 1    | user1  | 2    |
| 2    | user2  | 2    |
+------+--------+------+ {code}
 

 


> Incorrect query results on tables with ClusterBy & SortBy
> ---------------------------------------------------------
>
>                 Key: HIVE-27876
>                 URL: https://issues.apache.org/jira/browse/HIVE-27876
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Naresh P R
>            Priority: Major
>
> Repro:
>  
> {code:java}
> create external table test_bucket(age int, name string, dept string) clustered by (age, name) sorted by (age asc, name asc) into 2 buckets stored as orc;
> insert into test_bucket values (1, 'user1', 'dept1'), ( 2, 'user2' , 'dept2');
> insert into test_bucket values (1, 'user1', 'dept1'), ( 2, 'user2' , 'dept2');
> //empty wrong results
> select age, name, count(*) from test_bucket group by  age, name having count(*) > 1; 
> +------+-------+------+
> | age  | name  | _c2  |
> +------+-------+------+
> +------+-------+------+
> // Workaround
> set hive.map.aggr=false;
> select age, name, count(*) from test_bucket group by  age, name having count(*) > 1; 
> +------+--------+------+
> | age  |  name  | _c2  |
> +------+--------+------+
> | 1    | user1  | 2    |
> | 2    | user2  | 2    |
> +------+--------+------+ {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)