3

检查 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;

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

我想加入两个表和 LATERAL VIEW EXPLODE TABLEA

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

4

2 回答 2

9
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 
于 2017-07-27T03:40:55.273 回答
3

现在不在我的电脑上,所以没有办法测试这个,但我猜你必须编写一个内部查询。像这样的东西:

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
于 2017-07-27T03:44:53.830 回答