title: Add column in hive not allowed from scala/spark code
body: <p>I am trying to add a column in a Hive table if the source data has new columns. All the detection of new columns works well, however, when I try to add the column to the destination table, I receive this error:</p>
  
  <pre><code>for (f &lt;- df.schema.fields) {
    if ("[" + f.name + "]"==chk) {
      spark.sqlContext.sql("alter table dbo_nwd_orders add columns (" + f.name + " " + f.dataType.typeName.replace("integer", "int") + ")")
    }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>WARN HiveExternalCatalog: Could not alter schema of table  `default`.`dbo_nwd_orders` in a Hive compatible way. Updating Hive metastore in Spark SQL specific format
  InvalidOperationException(message:partition keys can not be changed.)
  </code></pre>
  
  <p>However, if I catch the alter sentence generated and execute it from hive GUI (HUE), I can add it without issues.</p>
  
  <pre><code>alter table dbo_nwd_orders add columns (newCol int)
  </code></pre>
  
  <p>Why that sentence is valid from the GUI and not from spark code?</p>
  
  <p>Thank you very much.</p>