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?

Donald Miner
  • 38,889
  • 8
  • 95
  • 118
hese
  • 3,397
  • 8
  • 25
  • 34

2 Answers2

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) 
Samuel Kerrien
  • 6,965
  • 2
  • 29
  • 32
26

Answering the question myself -

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

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

prongs
  • 9,422
  • 21
  • 67
  • 105
hese
  • 3,397
  • 8
  • 25
  • 34