title: filtering Pcollections in apache beam
body: <p>I have two Pcollections </p>
  
  <pre><code>P1  as Pcollection KV&lt;String,Object&gt;
  P2 as Pcollection  KV&lt;String,Long&gt;
  </code></pre>
  
  <p>The Keys in both Pcollections are same, However values are different. </p>
  
  <p>P1 as around 70 Million entries, P2 is subset of P1 and has 30 Million entries. </p>
  
  <p>Now I need to split P1 into two collections such that P1.A will contain only the keys found in P2, while P1.B will contain keys that are not present in P2. </p>
  
  <p>I dont want to use co-groupbykey or any join as it results in shuffling of data. </p>
  
  <p>Can 20M entries(all strings) be used as side input probably as a HashMap  ? Is this a good approach ? </p>
  
  <p>Do suggest any other optimal approaches to split P1 into two collections one which is intersection of keys in P2 while the other is minus of P2? </p>