Skip to content

Commit

Permalink
revert conditions in engineHomeDirFilter for future compatibility on …
Browse files Browse the repository at this point in the history
…Scala 3
  • Loading branch information
bowenliang123 committed Sep 21, 2023
1 parent a7f387f commit 2b8c3f2
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 2b8c3f2

Please sign in to comment.