title: Matching two dataframes in scala
body: <p>I have two RDDs in SCALA and converted those to dataframes.
  Now I have two dataframes.One <code>prodUniqueDF</code> where I have two columns named <code>prodid</code> and <code>uid</code>, it is having master data of product</p>
  
  <pre><code>scala&gt; prodUniqueDF.printSchema
  root
   |-- prodid: string (nullable = true)
   |-- uid: long (nullable = false)
  </code></pre>
  
  <p>Second, <code>ratingsDF</code> where I have columns named <code>prodid</code>,<code>custid</code>,<code>ratings</code></p>
  
  <pre><code>scala&gt; ratingsDF.printSchema
  root
  |-- prodid: string (nullable = true)
  |-- custid: string (nullable = true)
  |-- ratings: integer (nullable = false)
  </code></pre>
  
  <p><strong>I want to join the above two and replace the <code>ratingsDF.prodid</code> with <code>prodUniqueDF.uid</code>  in the <code>ratingsDF</code></strong></p>
  
  <p>To do this, I first registered them as 'tempTables'</p>
  
  <pre><code>prodUniqueDF.registerTempTable("prodUniqueDF")
  ratingsDF.registerTempTable("ratingsDF")
  </code></pre>
  
  <p>And I run the code</p>
  
  <pre><code>val testSql = sql("SELECT prodUniqueDF.uid, ratingsDF.custid, ratingsDF.ratings FROM prodUniqueDF, ratingsDF WHERE prodUniqueDF.prodid = ratingsDF.prodid")
  </code></pre>
  
  <p>But the error comes as : </p>
  
  <pre><code>org.apache.spark.sql.AnalysisException: Table not found: prodUniqueDF; line 1 pos 66
  </code></pre>
  
  <p>Please help! How can I achieve the join? Is there another method to map RDDs instead?</p>