title: How we can join the two tables if there is no common column values in spark sql
body: <p>I have two tables say <code>citizenship</code> and <code>country</code>:</p>
  
  <pre><code>country table
  _______________
  countryCode countryDescription
  
  IN           INDIA
  US           USA
  UK           United kingdom
  </code></pre>
  
  <hr>
  
  <pre><code>citizenship table
  _________________
  citizenshipId  CountryCode
  
  1              +IN,+US
  2               -IN,-UK
  3               " "
  4               null
  </code></pre>
  
  <p>I have to join the above tables in such a way that:</p>
  
  <ol>
  <li><p>If there is (<code>+</code>) sign before <code>countryCode</code> in <code>citizenship</code> table then it should join with country tables  with <code>countryCode</code> and give me that number of records.</p></li>
  <li><p>If there is (<code>-</code>) sign before the <code>countryCode</code> in <code>citizenship</code> table then it should join with country table and return the records except the countries with (<code>-</code>) sign.</p></li>
  <li><p>If there is empty string or null then it should join with all the <code>countryCode</code> in <code>country</code> table.</p></li>
  </ol>