hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashutosh Chauhan (JIRA)" <>
Subject [jira] [Commented] (HIVE-14251) Union All of different types resolves to incorrect data
Date Wed, 20 Jul 2016 15:45:20 GMT


Ashutosh Chauhan commented on HIVE-14251:

When we are making such semantic changes we should make change which takes us closer to standard.
So, it should help to read that to see what standard has to say here. 
I took this query and ran it against few databases:
* MySQL : same result as you are trying to achieve
* Postgres : exception : ERROR: UNION types date and integer cannot be matched Position: 53
* SQLServer: Different result set. It figured common type as date 2016-01-01 00:00:00.000
1900-01-06 00:00:00.000 1900-01-02 06:00:00.000

Couldn't try on oracle as I didnt had it handy. That would be good experiment too.
Clearly  its not consistent. My suggestion would be to read standard and try to emulate that
as much as possible.

> Union All of different types resolves to incorrect data
> -------------------------------------------------------
>                 Key: HIVE-14251
>                 URL:
>             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

View raw message