liupc commented on a change in pull request #23841: [SPARK-26936][SQL] Fix bug
of insert overwrite local dir and inconsistent behavior with Hive
URL: https://github.com/apache/spark/pull/23841#discussion_r258779330
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/InsertIntoHiveDirCommand.scala
##########
@@ -86,20 +86,21 @@ case class InsertIntoHiveDirCommand(
val jobConf = new JobConf(hadoopConf)
val targetPath = new Path(storage.locationUri.get)
- val writeToPath =
+ val qualifiedPath = FileUtils.makeQualified(targetPath, hadoopConf)
+ val (writeToPath : Path , fs : FileSystem) =
if (isLocal) {
val localFileSystem = FileSystem.getLocal(jobConf)
- localFileSystem.makeQualified(targetPath)
+ (localFileSystem.makeQualified(targetPath), localFileSystem)
} else {
- val qualifiedPath = FileUtils.makeQualified(targetPath, hadoopConf)
- val dfs = qualifiedPath.getFileSystem(jobConf)
- if (!dfs.exists(qualifiedPath)) {
- dfs.mkdirs(qualifiedPath.getParent)
- }
- qualifiedPath
+ val dfs = qualifiedPath.getFileSystem(hadoopConf)
+ (qualifiedPath, dfs)
}
+ if (!fs.exists(writeToPath)) {
+ fs.mkdirs(writeToPath)
+ }
- val tmpPath = getExternalTmpPath(sparkSession, hadoopConf, writeToPath)
+ // The temporary path must be a HDFS path but a local path.
Review comment:
but not a local path?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]