From 2b8c3f2c99d09c33cc6540c648a8ca265a0c39be Mon Sep 17 00:00:00 2001 From: Bowen Liang Date: Thu, 21 Sep 2023 13:41:59 +0800 Subject: [PATCH] revert conditions in engineHomeDirFilter for future compatibility on Scala 3 --- .../kyuubi/engine/spark/SparkProcessBuilder.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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) }