mcdull-zhang 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_r410088461
##########
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:
There is currently only insert overwrite directory syntax, overwrite must be
true now, the code retains this parameter, I feel that the designer for future
expansion.
----------------------------------------------------------------
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]