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_r410192866
 
 

 ##########
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/InsertIntoHiveDirCommand.scala
 ##########
 @@ -90,6 +90,15 @@ case class InsertIntoHiveDirCommand(
         val dfs = qualifiedPath.getFileSystem(hadoopConf)
         (qualifiedPath, dfs)
       }
+
+    if (fs.exists(writeToPath) && fs.isFile(writeToPath)) {
+      if (overwrite) {
+        fs.delete(writeToPath, true)
+      } else {
+        throw new SparkException(s"Failed inserting overwrite directory, " +
 
 Review comment:
   Ah, I see. Even so, we need tests for this path.

----------------------------------------------------------------
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]

Reply via email to