[ https://issues.apache.org/jira/browse/HIVE-14530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15445691#comment-15445691 ]
Jesus Camacho Rodriguez edited comment on HIVE-14530 at 8/29/16 12:16 PM: -------------------------------------------------------------------------- [~liwenhe], [~Spring], thanks for pointing this out. There was indeed a bug in the logic introduced in HIVE-13639 to infer constant values that can be pull up from the Union. I have just uploaded the fix, and I added the queries in the description to the testsuite. was (Author: jcamachorodriguez): [~liwenhe], [~Spring], thanks for pointing this out. There was indeed a bug in the logic introduced in HIVE-13639 to infers constant values that can be pull up from the Union. I have just uploaded the fix, and I added the queries in the description to the testsuite. > Union All query returns incorrect results. > ------------------------------------------ > > Key: HIVE-14530 > URL: https://issues.apache.org/jira/browse/HIVE-14530 > Project: Hive > Issue Type: Bug > Components: Query Planning > Affects Versions: 2.1.0 > Environment: Hadoop 2.6 > Hive 2.1 > Reporter: wenhe li > Assignee: Jesus Camacho Rodriguez > Attachments: HIVE-14530.patch > > > create table dw_tmp.l_test1 (id bigint,val string,trans_date string) row > format delimited fields terminated by ' ' ; > create table dw_tmp.l_test2 (id bigint,val string,trans_date string) row > format delimited fields terminated by ' ' ; > select * from dw_tmp.l_test1; > 1 table_1 2016-08-11 > select * from dw_tmp.l_test2; > 2 table_2 2016-08-11 > -- right like this > select > id, > 'table_1' , > trans_date > from dw_tmp.l_test1 > union all > select > id, > val, > trans_date > from dw_tmp.l_test2 ; > 1 table_1 2016-08-11 > 2 table_2 2016-08-11 > -- incorrect > select > id, > 999, > 'table_1' , > trans_date > from dw_tmp.l_test1 > union all > select > id, > 999, > val, > trans_date > from dw_tmp.l_test2 ; > 1 999 table_1 2016-08-11 > 2 999 table_1 2016-08-11 <-- here is wrong > -- incorrect > select > id, > 999, > 666, > 'table_1' , > trans_date > from dw_tmp.l_test1 > union all > select > id, > 999, > 666, > val, > trans_date > from dw_tmp.l_test2 ; > 1 999 666 table_1 2016-08-11 > 2 999 666 table_1 2016-08-11 <-- here is wrong > -- right > select > id, > 999, > 'table_1' , > trans_date, > '2016-11-11' > from dw_tmp.l_test1 > union all > select > id, > 999, > val, > trans_date, > trans_date > from dw_tmp.l_test2 ; > 1 999 table_1 2016-08-11 2016-11-11 > 2 999 table_2 2016-08-11 2016-08-11 -- This message was sent by Atlassian JIRA (v6.3.4#6332)