[ https://issues.apache.org/jira/browse/HIVE-7767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brock Noland updated HIVE-7767: ------------------------------- Description: Turing on the hive.optimize.union.remove property generates wrong union all result. For Example: {noformat} create table inputTbl1(key string, val string) stored as textfile; load data local inpath '../../data/files/T1.txt' into table inputTbl1; SELECT * FROM ( SELECT key, count(1) as values from inputTbl1 group by key UNION ALL SELECT key, count(1) as values from inputTbl1 group by key ) a; {noformat} when the hive.optimize.union.remove is turned on, the query result is like: {noformat} 1 1 2 1 3 1 7 1 8 2 {noformat} when the hive.optimize.union.remove is turned off, the query result is like: {noformat} 7 1 2 1 8 2 3 1 1 1 7 1 2 1 8 2 3 1 1 1 {noformat} The expected query result is: {noformat} 7 1 2 1 8 2 3 1 1 1 7 1 2 1 8 2 3 1 1 1 {noformat} was: Turing on the hive.optimize.union.remove property generates wrong union all result. For Example: create table inputTbl1(key string, val string) stored as textfile; load data local inpath '../../data/files/T1.txt' into table inputTbl1; SELECT * FROM ( SELECT key, count(1) as values from inputTbl1 group by key UNION ALL SELECT key, count(1) as values from inputTbl1 group by key ) a; when the hive.optimize.union.remove is turned on, the query result is like: 1 1 2 1 3 1 7 1 8 2 when the hive.optimize.union.remove is turned off, the query result is like: 7 1 2 1 8 2 3 1 1 1 7 1 2 1 8 2 3 1 1 1 The expected query result is: 7 1 2 1 8 2 3 1 1 1 7 1 2 1 8 2 3 1 1 1 > hive.optimize.union.remove does not work properly [Spark Branch] > ---------------------------------------------------------------- > > Key: HIVE-7767 > URL: https://issues.apache.org/jira/browse/HIVE-7767 > Project: Hive > Issue Type: Sub-task > Reporter: Na Yang > Assignee: Na Yang > > Turing on the hive.optimize.union.remove property generates wrong union all > result. > For Example: > {noformat} > create table inputTbl1(key string, val string) stored as textfile; > load data local inpath '../../data/files/T1.txt' into table inputTbl1; > SELECT * > FROM ( > SELECT key, count(1) as values from inputTbl1 group by key > UNION ALL > SELECT key, count(1) as values from inputTbl1 group by key > ) a; > {noformat} > when the hive.optimize.union.remove is turned on, the query result is like: > {noformat} > 1 1 > 2 1 > 3 1 > 7 1 > 8 2 > {noformat} > when the hive.optimize.union.remove is turned off, the query result is like: > {noformat} > 7 1 > 2 1 > 8 2 > 3 1 > 1 1 > 7 1 > 2 1 > 8 2 > 3 1 > 1 1 > {noformat} > The expected query result is: > {noformat} > 7 1 > 2 1 > 8 2 > 3 1 > 1 1 > 7 1 > 2 1 > 8 2 > 3 1 > 1 1 > {noformat} -- This message was sent by Atlassian JIRA (v6.2#6252)