我有一个Hive查询,类似于
insert into table all_data
select a,b from t1
union all
select a,b from t2`
上面的查询运行良好。当我将查询更改为以下内容时:
insert into table all_data
select a,b from t1
union all
select a,b from t2
union all
select a,b from t3
我得到了java Null指针错误。所以我认为最后一个查询有问题。然后我试试这个
insert into table all_data
select a,b from t3
它是有效的。问题是Union All查询失败,但查询本身可以工作。关于如何让它在Union All发挥作用,有什么建议吗?
试试这个。
insert into table all_data
select * from (
select a,b from t1
union all
select a,b from t2
union all
select a,b from t3
) u