How to do outer join on two columns in Pig Latin
Asked Answered
C

2

21

I do outer joins on single columns in Pig like this

result = JOIN A by id LEFT OUTER, B by id;

How do I join on two columns, something like -

WHERE A.id=B.id AND A.name=B.name

What is the pig equivalent? I couldn't find any example in the pig manuals...any help?

Colotomy answered 7/11, 2011 at 15:45 Comment(0)
C
26

Answering the question myself -

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

http://ofps.oreilly.com/titles/9781449302641/advanced_pig_latin.html

Colotomy answered 8/12, 2011 at 20:4 Comment(1)
You forgot LEFT OUTERVenture
M
40

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) 
Munroe answered 21/8, 2012 at 7:42 Comment(0)
C
26

Answering the question myself -

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

http://ofps.oreilly.com/titles/9781449302641/advanced_pig_latin.html

Colotomy answered 8/12, 2011 at 20:4 Comment(1)
You forgot LEFT OUTERVenture

© 2022 - 2024 — McMap. All rights reserved.