【发布时间】:2016-04-20 16:03:45
【问题描述】:
我在 HIVE 中有两个表:
- 表 A,其中包含列“N”,其类型为数组
- 表 B,其中“N”列未出现
表 A 和 B 都包含“C”列。
我想这样联合他们:
select g.* from
(select N, C from A
union all
select null as N, C from B
) g;
但这会在 HIVE 中引发错误:
FAILED:...Schema of both sides of union should match: Column N is of type array<string> on first table and type void on second table.
所以,我尝试转换数据类型:
select g.* from
(select N, C from A
union all
select cast(null as array) as N, C from B
) g;
"cannot recognize input near 'array' ')' 'as' in primitive type specification. 失败
我该如何解决这个问题?谢谢
【问题讨论】:
标签: arrays hive hiveql union-all