Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Union all error with hdp-2.5.3

Highlighted

Union all error with hdp-2.5.3

I am trying to run a simple hive query,

select
NULL as planned_date
from abc_table
union all
select 
event_date as planned_date 
from xyz_table

where event_date's event type in xyz_table is timestamp. When I try to run this in Hive 1.2.1000.2.4.3.0-227, it successfully runs but when i try to run this in Hive 1.2.1000.2.5.3.0-37 it fails saying SemanticException 145:5 Schema of both sides of union should match: Column planned_date is of type void on first table and type timestamp on second table.

Any suggestion how to solve this?

2 REPLIES 2
Highlighted

Re: Union all error with hdp-2.5.3

New Contributor
Highlighted

Re: Union all error with hdp-2.5.3

Explorer

This is a known issue issue (regression bug of Hive UNION logic in HDP 2.5.x)

https://issues.apache.org/jira/browse/HIVE-16050

The behaviour was introduced/changed by https://issues.apache.org/jira/browse/HIVE-14251, which was part of the HDP 2.5.x release

Workaround is to use 'cast' while running the query, for example:

select * from (select

case when browser_type is not null

THEN 'OPEN'

ELSE NULL

end as action_code

from mcom.esp_responsys_opened_stg

union all

select

cast(null as string) as action_code

from mcom.esp_responsys_complaint_stg_tmp) a limit 10;

Don't have an account?
Coming from Hortonworks? Activate your account here