lenoxzhao commented on code in PR #3908:
URL:
https://github.com/apache/incubator-streampark/pull/3908#discussion_r1686408989
##########
streampark-common/src/main/scala/org/apache/streampark/common/conf/SparkVersion.scala:
##########
@@ -98,7 +107,7 @@ class SparkVersion(val sparkHome: String) extends
Serializable with Logger {
override def accept(out: String): Unit = {
buffer.append(out).append("\n")
val matcher = SPARK_VERSION_PATTERN.matcher(out)
- if (matcher.find) {
+ if (matcher.find && StringUtils.isBlank(sparkVersion)) {
Review Comment:
Because the pattern is `Pattern.compile("(version) (\\d+\\.\\d+\\.\\d+)")`
so the output of `spark-submit --version` will be matched twice, first time to
`version 3.1.2` which corresponds to the Spark's version, and the second time
to `version 2.12.10` which corresponds to the Scala's version. So if
sparkVersion is not blank, it means that it has already been assigned with
Spark's version value. If we go into the if statement again, sparkVersion will
be overwritten by Scala's version value.

--
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]