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

2021-12-02 Thread Marton Bod (Jira)


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

Marton Bod commented on HIVE-25754:
---

Pushed to master. Thanks [~kkasa] for reviewing!

> 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:
> {code:java}
> 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);{code}
> If you run this query with UNION ALL, the {{key}} column will be missing from 
> the output:
> {code:java}
> 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{code}
> Result:
> {code:java}
> 1
> 2
> 11
> 22{code}
>  Correct result should be:
> {code:java}
> D219 1
> D220 2
> D221 11
> D222 22{code}



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


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

2021-12-01 Thread Marton Bod (Jira)


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

Marton Bod commented on HIVE-25754:
---

PR: [https://github.com/apache/hive/pull/2822]

 

> 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:
>  
> {code:java}
> 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);{code}
> If you run this query with UNION ALL, the {{key}} column will be missing from 
> the output:
>  
>  
> {code:java}
> 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{code}
> Result:
>  
> {code:java}
> 1
> 2
> 11
> 22{code}
>  
> Correct result should be:
> {code:java}
> D219 1
> D220 2
> D221 11
> D222 22{code}



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