diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala index b2793365a52..ff4ca77d85b 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala @@ -20,7 +20,6 @@ package org.apache.kyuubi.engine.spark import java.io.{File, FilenameFilter, IOException} import java.nio.file.Paths import java.util.Locale -import java.util.regex.Pattern import scala.collection.mutable import scala.collection.mutable.ArrayBuffer @@ -38,7 +37,7 @@ import org.apache.kyuubi.engine.ProcBuilder.KYUUBI_ENGINE_LOG_PATH_KEY import org.apache.kyuubi.ha.HighAvailabilityConf import org.apache.kyuubi.ha.client.AuthTypes import org.apache.kyuubi.operation.log.OperationLog -import org.apache.kyuubi.util.{KubernetesUtils, Validator} +import org.apache.kyuubi.util.{KubernetesUtils, SemanticVersion, Validator} class SparkProcessBuilder( override val proxyUser: String, @@ -115,9 +114,10 @@ class SparkProcessBuilder( StringUtils.defaultIfBlank(System.getenv("SPARK_SCALA_VERSION"), sparkCoreScalaVersion) override protected lazy val engineHomeDirFilter: FilenameFilter = { - val pattern = SCALA_COMPILE_VERSION match { - case "2.13" => "^spark-\\d+\\.\\d+\\.\\d+-bin-hadoop\\d(\\.\\d+)?+-scala\\d+(\\.\\d+)?$" - case _ => "^spark-\\d+\\.\\d+\\.\\d+-bin-hadoop\\d+(\\.\\d+)?$" + val pattern = if (SemanticVersion(SCALA_COMPILE_VERSION) >= "2.13") { + "^spark-\\d+\\.\\d+\\.\\d+-bin-hadoop\\d(\\.\\d+)?+-scala\\d+(\\.\\d+)?$" + } else { + "^spark-\\d+\\.\\d+\\.\\d+-bin-hadoop\\d+(\\.\\d+)?$" } new RegexFileFilter(pattern) }