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

the detail please refer the comment of https://issues.apache.org/jira/browse/SPARK-3007
`NumberFormat.getInstance()` is not thread-safe. We can use a thread-local variable to hold this object, similar to [`Cast.threadLocalDateFormat`](https://github.com/apache/spark/blob/eef779b8d631de971d440051cae21040f4de558f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala#L269-L273)