Skip to content

Commit 38b9752

Browse files
committed
Use exact pattern match to prevent future problem like Scala 2.12.
1 parent 95f740f commit 38b9752

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveSparkSubmitSuite.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ class HiveSparkSubmitSuite
9494
// Before the fix in SPARK-8470, this results in a MissingRequirementError because
9595
// the HiveContext code mistakenly overrides the class loader that contains user classes.
9696
// For more detail, see sql/hive/src/test/resources/regression-test-SPARK-8489/*scala.
97-
import Properties.versionString
98-
val version = versionString.substring(versionString.indexOf(" ") + 1,
99-
versionString.lastIndexOf("."))
97+
val version = Properties.versionNumberString match {
98+
case v if v.startsWith("2.10") || v.startsWith("2.11") => v.substring(0, 4)
99+
case x => throw new Exception(s"Unsupported Scala Version: $x")
100+
}
100101
val testJar = s"sql/hive/src/test/resources/regression-test-SPARK-8489/test-$version.jar"
101102
val args = Seq(
102103
"--conf", "spark.ui.enabled=false",

0 commit comments

Comments
 (0)