gaborgsomogyi commented on a change in pull request #24446: 
[SPARK-27552][SQL]The configuration `hive.exec.stagingdir` is invalid on 
Windows OS
URL: https://github.com/apache/spark/pull/24446#discussion_r280562791
 
 

 ##########
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/SaveAsHiveFile.scala
 ##########
 @@ -219,7 +219,7 @@ private[hive] trait SaveAsHiveFile extends 
DataWritingCommand {
     val fs: FileSystem = inputPath.getFileSystem(hadoopConf)
     var stagingPathName: String =
       if (inputPathName.indexOf(stagingDir) == -1) {
-        new Path(inputPathName, stagingDir).toString
+        new Path(inputPathName, stagingDir).toUri.getPath
 
 Review comment:
   +1 not to use `toUri`, please see the following:
   ```
   scala> import org.apache.hadoop.fs.Path
   import org.apache.hadoop.fs.Path
   
   scala> val f = new java.io.File("/tmp/chk %#chk")
   f: java.io.File = /tmp/chk %#chk
   
   scala> new Path(new Path(f.toURI()), "foo").toString
   res0: String = file:/tmp/chk %#chk/foo
   
   scala> new Path(new Path(f.toURI()), "foo").toUri.toString
   res1: String = file:/tmp/chk%20%25%23chk/foo
   ```
   

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