3
votes

Checking to see if this is possible in 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;

I can not find the answer in the docs. In short:

I want to JOIN on two tables AND LATERAL VIEW EXPLODE TABLEA

Seems simple enough but throws syntax issue.

2

2 Answers

9
votes
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 
3
votes

Not at my computer now, so no way to test this, but my guess is you'll have to write an inner query. Something like this:

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