You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Marton Bod (Jira)" <ji...@apache.org> on 2021/12/01 10:50:00 UTC

[jira] [Assigned] (HIVE-25754) Fix column projection for union all queries with multiple aliases

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

Marton Bod reassigned HIVE-25754:
---------------------------------


> Fix column projection for union all queries with multiple aliases
> -----------------------------------------------------------------
>
>                 Key: HIVE-25754
>                 URL: https://issues.apache.org/jira/browse/HIVE-25754
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Marton Bod
>            Assignee: Marton Bod
>            Priority: Major
>
> Given two tables:
> {{create table source1 (dt string, d1 int, d2 int) stored as orc;
> create table source2 (dt string, d1 int, d2 int) stored as orc;
> insert into source1 values ('20211107', 1, 2);
> insert into source2 values ('20211108', 11, 22);}}
> If you run this query with UNION ALL, the {{key}} column will be missing from the output:
> {{select explode(map('D219', D219
> ,'D220', D220)) as (key, value) from (}}
>    {{select '20211107' as date_key
> ,1 as D219
> ,2 as D220
> ) t}}
> {{union all}}
> {{select explode(map('D221', D221
> ,'D222', D222)) as (key, value)
> from (}}
>   {{select '20211107' as date_key
> ,1 as D221
> ,2 as D222
> ) t}}
> Result:
> {{1}}
> {{2}}
> {{11}}
> {{22}}
>  
> Correct result should be:
> {{D219	1}}
> {{D220	2}}
> {{D221	11}}
> {{D222	22}}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)