title: Join two ordinary RDDs with/without Spark SQL
body: <p>I need to join two ordinary <code>RDDs</code> on one/more columns. Logically this operation is equivalent to the database join operation of two tables. I wonder if this is possible only through <code>Spark SQL</code> or there are other ways of doing it.</p>
  
  <p>As a concrete example, consider 
  RDD <code>r1</code> with primary key <code>ITEM_ID</code>:</p>
  
  <pre><code>(ITEM_ID, ITEM_NAME, ITEM_UNIT, COMPANY_ID)
  </code></pre>
  
  <p>and RDD <code>r2</code> with primary key <code>COMPANY_ID</code>:</p>
  
  <pre><code>(COMPANY_ID, COMPANY_NAME, COMPANY_CITY)
  </code></pre>
  
  <p>I want to join <code>r1</code> and <code>r2</code>.</p>
  
  <p>How can this be done?</p>