[Solved-2 Solutions] How to do outer join on two columns in Pig Latin ?



Outer join

  • Records which will not join with the other record set are still included in the result

Problem:

  • If you do outer joins on single columns in Pig like this
result = JOIN A by id LEFT OUTER, B by id;
  • How do you join on two columns, something like -
WHERE A.id=B.id AND A.name=B.name

Solution 1:

The above answer is actually an INNER join, the correct pig statement should be:

join a by (id, name) LEFT OUTER, b by (id, name)

Solution 2:

  • Here is the answer for the above question is
join a by (id, name), b by (id, name) 

Related Searches to How to do outer join on two columns in Pig Latin ?