This is an automated email from the ASF dual-hosted git repository.
yangjie01 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new b03352b99bb9 [SPARK-54394][CORE] Move `isJavaVersionAtMost17` and
`isJavaVersionAtLeast21` from `core` to `common/utils`
b03352b99bb9 is described below
commit b03352b99bb9bf31aa6d45af04fae226f9287af0
Author: Kousuke Saruta <[email protected]>
AuthorDate: Tue Nov 18 16:32:22 2025 +0800
[SPARK-54394][CORE] Move `isJavaVersionAtMost17` and
`isJavaVersionAtLeast21` from `core` to `common/utils`
### What changes were proposed in this pull request?
This PR proposes to move `isJavaVersionAtMost17` and
`isJavaVersionAtLeast21` from `Utils.scala` in `core` to
`SparkSystemUtils.scala` in `common/utils`
### Why are the changes needed?
To allow components which don't depend on `core` (like components under
`common/utils`) use these methods. These utility methods can be commonly used
like `javeVersion` in `SparkSystemUtils.scala`.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
GA.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #53108 from sarutak/move-java-version.
Authored-by: Kousuke Saruta <[email protected]>
Signed-off-by: yangjie01 <[email protected]>
---
.../main/scala/org/apache/spark/util/SparkSystemUtils.scala | 11 +++++++++++
core/src/main/scala/org/apache/spark/util/Utils.scala | 10 ----------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git
a/common/utils/src/main/scala/org/apache/spark/util/SparkSystemUtils.scala
b/common/utils/src/main/scala/org/apache/spark/util/SparkSystemUtils.scala
index eccf556c424e..72c62c20d16e 100644
--- a/common/utils/src/main/scala/org/apache/spark/util/SparkSystemUtils.scala
+++ b/common/utils/src/main/scala/org/apache/spark/util/SparkSystemUtils.scala
@@ -39,6 +39,16 @@ private[spark] trait SparkSystemUtils {
*/
val javaVersion = JavaUtils.javaVersion
+ /**
+ * Whether the underlying Java version is at most 17.
+ */
+ val isJavaVersionAtMost17 = Runtime.version().feature() <= 17
+
+ /**
+ * Whether the underlying Java version is at least 21.
+ */
+ val isJavaVersionAtLeast21 = Runtime.version().feature() >= 21
+
/**
* Whether the underlying operating system is Windows.
*/
@@ -63,6 +73,7 @@ private[spark] trait SparkSystemUtils {
* Whether the underlying operating system is UNIX.
*/
val isUnix = JavaUtils.isUnix
+
}
object SparkSystemUtils extends SparkSystemUtils
diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala
b/core/src/main/scala/org/apache/spark/util/Utils.scala
index fc735ae3b99e..6babba0cd6d1 100644
--- a/core/src/main/scala/org/apache/spark/util/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -1855,16 +1855,6 @@ private[spark] object Utils
getHadoopFileSystem(new URI(path), conf)
}
- /**
- * Whether the underlying Java version is at most 17.
- */
- val isJavaVersionAtMost17 = Runtime.version().feature() <= 17
-
- /**
- * Whether the underlying Java version is at least 21.
- */
- val isJavaVersionAtLeast21 = Runtime.version().feature() >= 21
-
/**
* Whether the underlying JVM prefer IPv6 addresses.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]