Skip to content
Closed
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,9 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
*/
def addFile(path: String, recursive: Boolean): Unit = {
val uri = new URI(path)
val file = new File(path)
val schemeCorrectedPath = uri.getScheme match {
case null | "local" => "file:" + uri.getPath
case null | "local" => "file:" + file.getCanonicalPath
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For scoping, probably better to move new File(path) into the match block.

Also, we should include the "file" scheme in the case as well.

case _ => path
}

Expand Down