配置单元侧视图分解为2个表联接

ifsvaxew  于 2021-06-26  发布在  Hive
关注(0)|答案(2)|浏览(357)

正在检查是否可以在配置单元中执行此操作:

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;

我在文件里找不到答案。简而言之:
我想在两个表和横向视图上合并分解表
似乎很简单,但抛出语法问题。

rqmkfv5c

rqmkfv5c1#

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
wixjitnu

wixjitnu2#

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

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

相关问题