Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ case class CreateHiveTableAsSelectCommand(
return Seq.empty
}

// For CTAS, there is no static partition values to insert.
val partition = tableDesc.partitionColumnNames.map(_ -> None).toMap
Copy link
Member

@dongjoon-hyun dongjoon-hyun Dec 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logically, this happens not only CTAS but also INSERT. Never mind.

InsertIntoHiveTable(
tableDesc,
Map.empty,
partition,
query,
overwrite = false,
ifPartitionNotExists = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,17 @@ class InsertSuite extends QueryTest with TestHiveSingleton with BeforeAndAfter
}
}

test("SPARK-26307: CTAS - INSERT a partitioned table using Hive serde") {
withTable("tab1") {
withSQLConf("hive.exec.dynamic.partition.mode" -> "nonstrict") {
val df = Seq(("a", 100)).toDF("part", "id")
df.write.format("hive").partitionBy("part").mode("overwrite").saveAsTable("tab1")
df.write.format("hive").partitionBy("part").mode("append").saveAsTable("tab1")
}
}
}


Seq("LOCAL", "").foreach { local =>
Seq(true, false).foreach { caseSensitivity =>
Seq("orc", "parquet").foreach { format =>
Expand Down