Skip to content

Commit 3f9a188

Browse files
committed
modified some errors.
1 parent ed46047 commit 3f9a188

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

core/src/main/scala/org/apache/spark/deploy/PythonRunner.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ package org.apache.spark.deploy
1919

2020
import java.net.URI
2121
import java.io.File
22-
import scala.util.Try
2322

2423
import scala.collection.mutable.ArrayBuffer
2524
import scala.collection.JavaConversions._
25+
import scala.util.Try
2626

2727
import org.apache.spark.api.python.PythonUtils
2828
import org.apache.spark.util.{RedirectThread, Utils}
@@ -98,7 +98,7 @@ object PythonRunner {
9898

9999
// In Windows, the drive should not be prefixed with "/"
100100
// For instance, python does not understand "/C:/path/to/sheep.py"
101-
if (formattedPath.matches("/[a-zA-Z]:/.*")) {
101+
if (Utils.isWindows && formattedPath.matches("/[a-zA-Z]:/.*")) {
102102
formattedPath = formattedPath.stripPrefix("/")
103103
}
104104
formattedPath

core/src/test/scala/org/apache/spark/deploy/PythonRunnerSuite.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.spark.deploy
1919

2020
import org.scalatest.FunSuite
21+
2122
import org.apache.spark.util.Utils
2223

2324
class PythonRunnerSuite extends FunSuite {
@@ -29,9 +30,9 @@ class PythonRunnerSuite extends FunSuite {
2930
assert(PythonRunner.formatPath("file:///spark.py") === "/spark.py")
3031
assert(PythonRunner.formatPath("local:/spark.py") === "/spark.py")
3132
assert(PythonRunner.formatPath("local:///spark.py") === "/spark.py")
32-
assert(PythonRunner.formatPath("file:/C:/a/b/spark.py", testWindows = true) ===
33-
"C:/a/b/spark.py")
3433
if (Utils.isWindows) {
34+
assert(PythonRunner.formatPath("file:/C:/a/b/spark.py", testWindows = true) ===
35+
"C:/a/b/spark.py")
3536
assert(PythonRunner.formatPath("C:\\a\\b\\spark.py", testWindows = true) ===
3637
"C:/a/b/spark.py")
3738
assert(PythonRunner.formatPath("C:\\a b\\spark.py", testWindows = true) ===

repl/scala-2.10/src/main/scala/org/apache/spark/repl/SparkILoop.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class SparkILoop(
207207
SparkILoop.getAddedJars.map { jar => new URI(jar).getPath.stripPrefix("/") }
208208
} else {
209209
// We need new URI(jar).getPath here for the case that `jar` includes encoded white space (%20).
210-
SparkILoop.getAddedJars.map { jar => new URI(jar).getPath}
210+
SparkILoop.getAddedJars.map { jar => new URI(jar).getPath }
211211
}
212212
// work around for Scala bug
213213
val totalClassPath = addedJars.foldLeft(

0 commit comments

Comments
 (0)