title: How to filter a (a,b) relation by (b,a)?
body: <p>I have a generic relation A like this:</p>
  
  <pre><code>DUMP A;
  (a, b)
  (a, c)
  (a, d)
  (b, a)
  (d, a)
  (d, b)
  </code></pre>
  
  <p>See that there is the pair (a,b) and (b,a); but there isn't a pair for (d,b).
  I want to filter those "unpaired" tuples out.</p>
  
  <p>The final result should be something like:</p>
  
  <pre><code>DUMP R; 
  (a, b)
  (a, d)
  (b, a)
  (d, a)
  </code></pre>
  
  <p>How can I write this on PIG?</p>
  
  <p>I was able to solve with the following code, but the cross operation is too expensive:</p>
  
  <pre><code>A_cp = FOREACH L GENERATE u1, u2;
  X = CROSS A, A_cp;
  F = FILTER X BY ($0 == $3 AND $1 == $2);
  R = FOREACH F GENERATE $0, $1;
  </code></pre>