title: Conditional join on different columns
body: <p>What is the most effective way to write this in pyspark:</p>
  
  <p>Pseudocode: </p>
  
  <pre><code>table1 inner join table2 
  on cookies if table1.cookie is not Null 
  else join on ids
  </code></pre>
  
  <p>table1:</p>
  
  <pre><code>id, cookie
  1, 1q2w
  2, Null
  </code></pre>
  
  <p>table2:</p>
  
  <pre><code>id, cookie
  1, 1q2w
  2, 3e4r
  </code></pre>