You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ya...@apache.org on 2023/12/23 10:08:37 UTC
(spark) branch master updated: [SPARK-46479][CORE] Change `Utils.isJavaVersionAtLeast21` to use the utility method from `commons-lang3`
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 0c29593436d5 [SPARK-46479][CORE] Change `Utils.isJavaVersionAtLeast21` to use the utility method from `commons-lang3`
0c29593436d5 is described below
commit 0c29593436d542f816d95e3575296d0588895c7c
Author: yangjie01 <ya...@baidu.com>
AuthorDate: Sat Dec 23 18:08:22 2023 +0800
[SPARK-46479][CORE] Change `Utils.isJavaVersionAtLeast21` to use the utility method from `commons-lang3`
### What changes were proposed in this pull request?
Apache commons-lang3 added support for checking `JAVA_21` after version 3.13.0, so this pr change `Utils.isJavaVersionAtLeast21` to use the utility method from commons-lang3.
### Why are the changes needed?
Use commons-lang3 utility method.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Pass GitHub Actions
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #44444 from LuciferYang/SPARK-46479.
Authored-by: yangjie01 <ya...@baidu.com>
Signed-off-by: yangjie01 <ya...@baidu.com>
---
core/src/main/scala/org/apache/spark/util/Utils.scala | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
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 a074bd53d26d..09f6c5344546 100644
--- a/core/src/main/scala/org/apache/spark/util/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -50,7 +50,7 @@ import com.google.common.io.{ByteStreams, Files => GFiles}
import com.google.common.net.InetAddresses
import org.apache.commons.codec.binary.Hex
import org.apache.commons.io.IOUtils
-import org.apache.commons.lang3.SystemUtils
+import org.apache.commons.lang3.{JavaVersion, SystemUtils}
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.{FileSystem, FileUtil, Path}
import org.apache.hadoop.io.compress.{CompressionCodecFactory, SplittableCompressionCodec}
@@ -1774,8 +1774,7 @@ private[spark] object Utils
/**
* Whether the underlying Java version is at least 21.
*/
- val isJavaVersionAtLeast21 =
- System.getProperty("java.version").split("[+.\\-]+", 3)(0).toInt >= 21
+ val isJavaVersionAtLeast21 = SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_21)
/**
* Whether the underlying operating system is Mac OS X and processor is Apple Silicon.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org