title: How to insert Spark DataFrame to Hive Internal table?
body: <p>What's the right way to insert DF to Hive Internal table in Append Mode. It seems we can directly write the DF to Hive using "saveAsTable" method OR store the DF to temp table then use the query.</p>
  
  <pre><code>df.write().mode("append").saveAsTable("tableName")
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>df.registerTempTable("temptable") 
  sqlContext.sql("CREATE TABLE IF NOT EXISTS mytable as select * from temptable")
  </code></pre>
  
  <p>Will the second approach append the records or overwrite it?</p>
  
  <p>Is there any other way to effectively write the DF to Hive Internal table?</p>