2016-12-01 202 views
0

我试图做这样的查询:如何在子查询中使用LATERAL VIEW OUTER EXPLODE的结果?

select * from tbl LATERAL VIEW OUTER explode(column) temp_tbl as the_col WHERE (the_col IN (select column from tbl2))

,它给这个错误:

Unsupported SubQuery Expression: Correlating expression cannot contain unqualified column references

我看着this答案,并改变了查询:

select * from tbl LATERAL VIEW OUTER explode(column) temp_tbl as the_col WHERE (tbl.the_col IN (select column from tbl2))

现在我得到这个错误:

FAILED: SemanticException Line XX:XX Invalid column reference 'the_col' in definition of SubQuery sq_1

这里发生了什么事以及如何解决这个问题?

回答

0

试试这个,

SELECT * FROM (
     SELECT * FROM tbl 
     LATERAL VIEW OUTER explode(column) temp_tbl as the_col) a 
WHERE a.the_col IN (select column from tbl2); 
相关问题