bowenliang123 commented on code in PR #5196:
URL: https://github.com/apache/kyuubi/pull/5196#discussion_r1325563088
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala:
##########
@@ -102,6 +104,20 @@ class SparkProcessBuilder(
}
}
+ override protected def engineScalaBinaryVersion: String =
+ StringUtils.defaultIfBlank(System.getenv("SPARK_SCALA_VERSION"),
sparkCoreScalaVersion)
+
+ private def sparkCoreScalaVersion: String = {
+ val sparkCoreJarPattern = Pattern.compile("^spark-core_.*\\.jar$")
+ Paths.get(sparkHome, "jars").toFile
+ .list((_, fileName) => sparkCoreJarPattern.matcher(fileName).matches())
+ .map { p => p.substring(p.indexOf("_") + 1, p.lastIndexOf("-")) }
+ .headOption match {
+ case Some(scalaVersion) => scalaVersion
+ case None => scalaRuntimeSemanticVersion.toString
Review Comment:
It's for a falling back if the scala version is unparsable from the spark
core jar.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]