Hive Union ALL - java nullpointer异常 [英] Hive Union ALL - java nullpointer exception

查看:550
本文介绍了Hive Union ALL - java nullpointer异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 插入表all_data 
select a,b from t1
union all
从t2`
中选择a,b

上述查询工作正常。
当我将查询更改为以下内容:

 插入表all_data 
从t1中选择a,b
union all
从t2中选择a,b
union all
从t3中选择a,b

我得到java空指针错误。所以我认为最后一个查询有问题。
然后我试试这个

 插入表all_data 
从t3
中选择a,b

它可行。
问题是联合所有查询都失败,但是它自己的查询起作用。
如何在Union All中使用任何指针?

解决方案

试试这个。

 插入表all_data 
select * from(
从t1中选择a,b
union全部
选择a,b从t2
union all
选择a,b从t3
)u


I have a Hive query which is something like this

insert into table all_data
  select a,b from t1
  union all
  select a,b from t2`

The above query works fine. When I change my query to following:

insert into table all_data
  select a,b from t1
  union all
  select a,b from t2
  union all
  select a,b from t3

I get java Null-pointer errors. SO I assume that the last query has an issue. Then I try this

insert into table all_data
  select a,b from t3

And it works. The problem is Union All the query fails but on its own the query works. Any pointers on how to get it working in Union All?

解决方案

try this.

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

这篇关于Hive Union ALL - java nullpointer异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆