You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Aihua Xu (JIRA)" <ji...@apache.org> on 2016/07/20 19:22:20 UTC

[jira] [Comment Edited] (HIVE-14251) Union All of different types resolves to incorrect data

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

Aihua Xu edited comment on HIVE-14251 at 7/20/16 7:21 PM:
----------------------------------------------------------

Thanks for the suggestion. I went through the sql standard. Seems like the standard is treating union as another union join, but doesn't explicitly mention the behavior of mismatched type. Oracle requires the union types are in the same type group from the doc (I don't have one either to try out), but the doc is pretty clear that it won't do implicit type conversion across type groups (https://docs.oracle.com/cd/B19306_01/server.102/b14200/queries004.htm). 

 


was (Author: aihuaxu):
Thanks for the suggestion. I went through the sql standard. Seems like the standard is treating union as another union join, but doesn't explicitly mention the behavior of mismatched type. Oracle requires the union types are in the same type group from the doc (I don't have one either to try out either), but the doc is pretty clear that it won't do implicit type conversion across type groups (https://docs.oracle.com/cd/B19306_01/server.102/b14200/queries004.htm). 

 

> Union All of different types resolves to incorrect data
> -------------------------------------------------------
>
>                 Key: HIVE-14251
>                 URL: https://issues.apache.org/jira/browse/HIVE-14251
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Planning
>    Affects Versions: 2.0.0
>            Reporter: Aihua Xu
>            Assignee: Aihua Xu
>         Attachments: HIVE-14251.1.patch
>
>
> create table src(c1 date, c2 int, c3 double);
> insert into src values ('2016-01-01',5,1.25);
> select * from 
> (select c1 from src union all
> select c2 from src union all
> select c3 from src) t;
> It will return NULL for the c1 values. Seems the common data type is resolved to the last c3 which is double.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)