This is an automated email from the ASF dual-hosted git repository.
felixybw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 59e1f33052 [GLUTEN-10318] Improve the compareMajorMinorVersion for
SparkVersionUtil (#10319)
59e1f33052 is described below
commit 59e1f33052bbaabc8e2d0566454ba5a6fe0d09a9
Author: Jiaan Geng <[email protected]>
AuthorDate: Tue Aug 5 02:20:43 2025 +0800
[GLUTEN-10318] Improve the compareMajorMinorVersion for SparkVersionUtil
(#10319)
improve the compareMajorMinorVersion for SparkVersionUtil
---
.../main/scala/org/apache/spark/util/SparkVersionUtil.scala | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git
a/gluten-core/src/main/scala/org/apache/spark/util/SparkVersionUtil.scala
b/gluten-core/src/main/scala/org/apache/spark/util/SparkVersionUtil.scala
index 0313432427..d1febeaa9c 100644
--- a/gluten-core/src/main/scala/org/apache/spark/util/SparkVersionUtil.scala
+++ b/gluten-core/src/main/scala/org/apache/spark/util/SparkVersionUtil.scala
@@ -19,9 +19,11 @@ package org.apache.spark.util
object SparkVersionUtil {
// Returns X. X < 0 if one < other, x == 0 if one == other, x > 0 if one >
other.
def compareMajorMinorVersion(other: (Int, Int)): Int = {
- val current =
VersionUtils.majorMinorVersion(org.apache.spark.SPARK_VERSION)
- val base = 1000
- assert(current._2 < base && other._2 < base)
- current._1 * base + current._2 - (other._1 * base + other._2)
+ val (major, minor) =
VersionUtils.majorMinorVersion(org.apache.spark.SPARK_VERSION)
+ if (major == other._1) {
+ minor - other._2
+ } else {
+ major - other._1
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]