【发布时间】:2014-08-12 01:43:22
【问题描述】:
我正在使用 Apache Hive 0.13(它支持子查询)并且我正在尝试运行其子查询使用 LATERAL VIEW 和 explode() 的查询。我不断收到 NPE:
失败:NullPointerException null
我已经单独和独立地尝试过子查询,它工作正常。我也找不到在 Hive 的documentation 中使用 LATERAL VIEW 进行子查询的任何限制@
所以我想知道我的查询有什么问题。你可以看到下面的查询:
select u.name, u.employment
from users u
where u.id IN (
SELECT distinct su.id
FROM users su LATERAL VIEW explode(su.employment) empTable AS emp
where su.frCount >= 10
and su.frCount < 20
and emp.endDate is NULL
);
我正在使用带有 JSON 数据的 Hive。这是表的 DDL:
CREATE TABLE users(
id BIGINT,
name string,
frCount INT,
employment array<struct<
organization_name : string,
start_date: BIGINT,
end_date: BIGINT>>
) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' STORED AS TEXTFILE;
【问题讨论】:
-
您能否举例说明您查询的表中的数据是什么样的?
-
谢谢回复。刚刚在上面添加了DDL。
标签: hadoop subquery hive hiveql