[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
Is it always called after `executorSideSetup`? If so, can we rename it to something like `setupWriter` (or `initWriter`) and call it at the end of `executorSideSetup` instead of call it in `writeToFile`?