[SPARK-3007][SQL]Add "Dynamic Partition" support to Spark Sql hive

a new PR base on new master.  changes are the same as https://github.com/apache/spark/pull/1919
This for-loop check is incorrect and dangerous, `partitionSpec` is a `Map`, which is not an ordered sequence. Instead, we can have something like this:

```scala
// Report error if any static partition appears after a dynamic partition
val isDynamic = partitionColumnNames.map(partitionSpec(_).isEmpty)
isDynamic.init.zip(isDynamic.tail).find(_ == (true, false)).foreach { _ =>
  throw new SparkException(ErrorMsg.PARTITION_DYN_STA_ORDER.getMsg)
}
```