Skip to content
Closed
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 @@ -730,6 +730,25 @@ class InsertSuite extends QueryTest with TestHiveSingleton with BeforeAndAfter
}
}

test("insert overwrite to not exists dir will lead to expected dir is a file indeed.") {
val testMaster = System.getProperty("spark.sql.test.master")
logWarning(s"Unit test master is $testMaster")
withTempDir { dir =>
val path = dir.toURI.getPath
val notExistsPath = s"$path/noexistdir"
val target = new File(notExistsPath)
if (target.exists()) {
target.delete()
}
assert(!target.exists())

sql(s"INSERT OVERWRITE LOCAL DIRECTORY '$notExistsPath' SELECT * FROM src where key < 10")

assert(target.isFile())
assert(!target.isDirectory())
}
}

test("SPARK-21165: FileFormatWriter should only rely on attributes from analyzed plan") {
withSQLConf(("hive.exec.dynamic.partition.mode", "nonstrict")) {
withTable("tab1", "tab2") {
Expand Down