Hive 横向视图以 2 table 连接爆炸

Hive lateral view explode with 2 table joins

正在检查这在 Hive 中是否可行:

Select a.col1,b.col1
from tableA a join tableB b on a.col1 = b.col1
lateral view explode(numcred) tableA  as creds
where creds.id = 9;

我在文档中找不到答案。简而言之:

我想在两个表上加入 AND LATERAL VIEW EXPLODE TABLEA

看起来很简单,但会引发语法问题。

select  a.col1
       ,b.col1

from   (Select  a.col1

        from    tableA a 
                lateral view explode(numcred) e as creds 

        where   e.creds.id = 9
        ) a

        join    tableB b 

        on      a.col1 = b.col1 

现在不在我的电脑上,所以无法对此进行测试,但我猜你必须编写一个内部查询。像这样:

SELECT
  a.col1,
  b.col1
FROM (
  SELECT
    dummy.col1
  FROM table_a dummy
  LATERAL VIEW EXPLODE(numcred) tableA as creds
  WHERE 
    creds.id = 9
) a
JOIN tableB b 
ON 
  a.col1 = b.col1