maropu commented on a change in pull request #28232: [SPARK-31459][SQL]fix
insert overwrite directory target path is an existing file
URL: https://github.com/apache/spark/pull/28232#discussion_r410512890
##########
File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/InsertSuite.scala
##########
@@ -769,6 +769,32 @@ class InsertSuite extends QueryTest with
TestHiveSingleton with BeforeAndAfter
}
}
+ test("SPARK-31459: fix insert overwrite directory target path is an existing
file") {
+ withTempView("test_insert_table") {
+ spark.range(10).selectExpr("id", "id AS
str").createOrReplaceTempView("test_insert_table")
+
+ withTempDir { dir =>
+ val tempFile = File.createTempFile("targetPath", "", dir)
+ val path = tempFile.toURI.getPath
+
+ val testSql =
+ s"""
+ |INSERT OVERWRITE LOCAL DIRECTORY '${path}'
+ |STORED AS orc
+ |SELECT * FROM test_insert_table
+ """.stripMargin
Review comment:
nit: you don't need to use the variable here;
```
sql(
s"""
|...
""".stripMargin)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]