Repository navigation
Conversation
|
cc @LuciferYang |
|
I don't have any issues with the code change itself. But will modifying just this part address Cause 2 described in the PR?
|
|
@pan3793 What I mean is, could using an older version of common-lang3 potentially result in the absence of other methods? Could the issue solely be related to the enumeration problem in this particular version of Java? |
Yes, it's possible, Spark has no guarantee to work with older |
|
Thank you for making a PR. I got your point of this proposal. However, actually, I have a different perspective with the following claim, @pan3793 .
Java Community is also notorious with the incompatible change of version number. For example, Java-based ASF projects (Apache Hadoop/Hive/Spark) had a bad memory about this to handle both From the beginning, I don't think
In short, it's not a good idea to downgrade Apache Spark's jar dependency with a user-provide one. And, this PR might give a wrong idea to the users which we allow (and guarantee) a user to downgrade it. In fact, we should not and never recommend that way. |
|
To @pan3793 , to achieve your goal, we need to remove the |
|
@dongjoon-hyun thanks for your review and explanation about your concerns. first of all, sorry if I make thing confusing, to clarify, my goal is not "remove the commons-lang3 dependency completely", actually, unlike Guava, commons-lang3 keeps pretty good backward-compatibility. and I understand that the change in versioning policy during Java 8 caused some confusion, for projects that supports Java 8 and above, I agree that common-lang3 might be the best and simplest way to handle the JDK vesion, but given now Spark requires Java 17+ and modern JDKs provide simple and stable API (via JEP 223) to get and compare the version (in addition to feature(major) version of JDK, JEP 223 API also provides interim/update/patch version info, which was used in SPARK-50946), switching to JEP 223 API seems to be a future-proofing selection.
I absolutely agree with that, I strongly discourage our users/customers to use regards to In short, I think there is no obviously drawback in switching to JEP 223 API, and I can update the PR description to remove the commons-lang3 compatibility words if it cause confusing. |
|
For the following, I'd like to recommend alternative.
WDYT, @pan3793 ? |
| </check> | ||
|
|
||
| <check customId="commonslang3javaversion" level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> | ||
| <parameters><parameter name="regex">org\.apache\.commons\.lang3\..*JavaVersion</parameter></parameters> |
|
@dongjoon-hyun thanks for your suggestion, sgtm, updated. |
| </check> | ||
|
|
||
| <check customId="commonslang3javaversion" level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> | ||
| <parameters><parameter name="regex">org\.apache\.commons\.lang3\.JavaVersion</parameter></parameters> |
There was a problem hiding this comment.
We need more complex pattern due to the curly brace, {.
$ git grep JavaVersion | grep import
core/src/main/scala/org/apache/spark/util/Utils.scala:import org.apache.commons.lang3.{JavaVersion, SystemUtils}
sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveExternalCatalogVersionsSuite.scala:import org.apache.commons.lang3.{JavaVersion, SystemUtils}
streaming/src/test/scala/org/apache/spark/streaming/util/WriteAheadLogSuite.scala:import org.apache.commons.lang3.{JavaVersion, SystemUtils}
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, LGTM. Thank you, @pan3793 .
Merged to master for Apache Spark 4.1.0.
### What changes were proposed in this pull request? This PR aims to upgrade `commons-lang3` to 3.18.0. Although SPARK-52469 removes ` org.apache.commons.lang3.JavaVersion` usages, we still use many methods of `commons-lang3`. - #51174 ### Why are the changes needed? To bring the latest bug fixes. - https://commons.apache.org/proper/commons-lang/changes.html#a3.18.0 - apache/commons-lang/pull/1327 - apache/commons-lang/pull/1297 - apache/commons-lang/pull/1273 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #51460 from dongjoon-hyun/SPARK-52778. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: yangjie01 <yangjie01@baidu.com>


What changes were proposed in this pull request?
Use JEP 223 API instead of
commons-lang3to process Java version.Checkstyle and Scalastyle configuration files are updated too to avoid future regression.
Why are the changes needed?
JEP 223 API is available in modern JDKs, it provides simple and richer API compared to
org.apache.commons.lang3.JavaVersionto process Java version.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Pass GHA.
Was this patch authored or co-authored using generative AI tooling?
No.