07ARB commented on a change in pull request #26773:
[SPARK-30126][CORE]sparkContext.addFile fails when file path contains…
URL: https://github.com/apache/spark/pull/26773#discussion_r354722031
##########
File path: core/src/main/scala/org/apache/spark/SparkContext.scala
##########
@@ -1538,7 +1538,7 @@ class SparkContext(config: SparkConf) extends Logging {
val scheme = new URI(schemeCorrectedPath).getScheme
if (!Array("http", "https", "ftp").contains(scheme)) {
val fs = hadoopPath.getFileSystem(hadoopConfiguration)
- val isDir = fs.getFileStatus(hadoopPath).isDirectory
+ val isDir = fs.getFileStatus(new Path(path)).isDirectory
Review comment:
@cloud-fan, yes ,
org.apache.hadoop.fs.RawLocalFileSystem#deprecatedGetFileStatus (inside this
method path.exists will return false)
because java.io.File#exists method will return false (reason:- the file
denoted by this abstract pathname is not exists)
becuase space is got encoded by %20 but if will pass simple path then it
will find the file and will return true.
```
java.io.FileNotFoundException: File
file:/Users/ankitrajboudh/test%20dir/ankit.conf does not exist
at
org.apache.hadoop.fs.RawLocalFileSystem.deprecatedGetFileStatus(RawLocalFileSystem.java:611)
at
org.apache.hadoop.fs.RawLocalFileSystem.getFileLinkStatusInternal(RawLocalFileSystem.java:824)
at
org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:601)
at
org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:428)
at org.apache.spark.SparkContext.addFile(SparkContext.scala:1541)
at org.apache.spark.SparkContext.addFile(SparkContext.scala:1505)
```
----------------------------------------------------------------
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]