You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Stéphane (JIRA)" <ji...@apache.org> on 2019/03/08 14:15:00 UTC

[jira] [Created] (HIVE-21413) Bad result using UNION using same table

Stéphane created HIVE-21413:
-------------------------------

             Summary: Bad result using UNION using same table
                 Key: HIVE-21413
                 URL: https://issues.apache.org/jira/browse/HIVE-21413
             Project: Hive
          Issue Type: Bug
          Components: hpl/sql
    Affects Versions: 1.2.1
         Environment: engine = mr

 

TBLPROPERTIES(
    'auto.purge'='true',
    'orc.compress'='ZLIB',
    'serialization.null.format'=''
)

 
            Reporter: Stéphane


Hi,

I have a table named "sau' with 1000 rows.

The table structure is :
 
||col_name ||data_type||comment |
|id       |string    |        |
|mnta     |int       |        |
|mntb     |int       |        |

{quote}with
cte as (
    select * from sau
)
select id, 'A' as info, mntA as mnt from cte
union
select id, 'B' as info, mntB as mnt from cte
{quote}
==> return only rows with "info=B"

{quote}with
cte as (
    select * from sau
),
cte_union as (
    select id, 'A' as info, mntA as mnt from cte
    union
    select id, 'B' as info, mntB as mnt from cte
)
select
    count(*)
from
    cte_union{quote}

==> return 1000 but should be 2000
 
I don't know if this bug is fixed on new version.

Using "union all" clause, the result is correct.




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)