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_r355103961
##########
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:
create Path from URI directly is working, but again we will get exception
during fetching schema `val scheme = new URI(schemeCorrectedPath).getScheme`
because file path will contain space
```
java.net.URISyntaxException: Illegal character in path at index 25:
/Users/ankitrajboudh/test dir/ankit.conf
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parseHierarchical(URI.java:3105)
at java.net.URI$Parser.parse(URI.java:3063)
at java.net.URI.<init>(URI.java:588)
at org.apache.spark.SparkContext.addFile(SparkContext.scala:1538)
at org.apache.spark.SparkContext.addFile(SparkContext.scala:1505)
... 47 elided
```
for handling this i we will pass URI.toString `val scheme = uri.getScheme`
----------------------------------------------------------------
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]