Github user gatorsmile commented on the issue: https://github.com/apache/spark/pull/14634 If users want to use the `DataFrameWriter`'s `insertInto` API for partitioned Hive table, they have to set `hive.exec.dynamic.partition` to `true` and `hive.exec.dynamic.partition.mode` to `nonstrict`. Otherwise, it does not work. Users are unable to specify the partition values in the `insertInto` APIs. See [the code](https://github.com/apache/spark/blob/8c8acdec9365136cba13060ce36c22b28e29b59b/sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala#L258). Let me use a test case to show the issue. ```Scala withTempDir { tmpDir => val basePath = tmpDir.getCanonicalPath val externalTab = "extTable_with_partitions" withTable(externalTab) { assert(tmpDir.listFiles.isEmpty) sql( s""" |CREATE EXTERNAL TABLE $externalTab (key INT, value STRING) |PARTITIONED BY (ds STRING, hr STRING) |stored as Parquet |LOCATION '$basePath' """.stripMargin) for (ds <- Seq("2008-04-08", "2008-04-09"); hr <- Seq("11", "12")) { sql( s""" |INSERT OVERWRITE TABLE $externalTab |partition (ds='$ds',hr='$hr') |SELECT 1, 'a' """.stripMargin) } withSQLConf("hive.exec.dynamic.partition" -> "true", "hive.exec.dynamic.partition.mode" -> "nonstrict") { Seq((1, "2", "2008-04-09", "12")).toDF("key", "value", "ds", "hr").write .insertInto(externalTab) } } } ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org