title: Partitioned Tables in Spark SQL
body: <p>I was experimenting with inserting data into a partitioned table.  Irrespective of whether or not I mention the keyword, 'repartition' or 'partition', I see the data is fitting correctly into the respective partitions.  So, I am wondering, if there is any significance to the keywords shown below:</p>
  
  <pre><code>scala&gt; input.repartition($"decade").registerTempTable("second_table")
  
  spark.sql("insert into lakehuron partition(decade) select date,level,decade from second_table")
  </code></pre>
  
  <p>In the above code, I repeated the exercise twice, once removing the keyword 'repartition' in the first line and again by removing both 'repartition' in the first line and 'partition' in the second line.  Both were inserting the data correctly into the respective partitions and I was able to see new files getting generated within the right partition <code>/user/hive/warehouse/lakehuron/decade=1960</code></p>
  
  <p>Please help me understand the significance of these key words.</p>