-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support building with Java 21 #10474
Conversation
9d01de8
to
04a5c77
Compare
5b03499
to
f564c36
Compare
7ca0b11
to
d9bae17
Compare
344c830
to
92c17e6
Compare
@@ -59,6 +59,10 @@ project(":iceberg-spark:iceberg-spark-${sparkMajorVersion}_${scalaVersion}") { | |||
implementation project(':iceberg-parquet') | |||
implementation project(':iceberg-arrow') | |||
implementation("org.scala-lang.modules:scala-collection-compat_${scalaVersion}:${libs.versions.scala.collection.compat.get()}") | |||
if (scalaVersion == '2.12') { | |||
// scala-collection-compat_2.12 pulls scala 2.12.17 and we need 2.12.18 for JDK 21 support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this also apply for Scala 2.13?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently not, i think the Ci would detect that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you remember what the exact error msg was here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't, i should have kept a note
Finally not draft anymore! |
apply plugin: 'com.diffplug.spotless' | ||
// We need to update Google Java Format to 1.17.0+ to run spotless on JDK 8, but that requires dropping support for JDK 8. | ||
if (JavaVersion.current() != JavaVersion.VERSION_21) { | ||
apply plugin: 'com.diffplug.spotless' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can merge the PR without having spotless enabled unfortunately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish this was avoidable. I do not know of a way to run same formatting rules under Java 8 and Java 21 and that's we support today.
I do believe that being able to test and actually testing with 21 is incremental improvement over current state. I see value in adding even partial support for 21. In particular, this PR identifies a problem with scala 2.12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you bring this topic up on the Dev mailing list to see what others think about adding JDK21 support without being able to run spotless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comment is not accurate: we need to update Google Java Format to 1.17.0+ to run spotless on JDK21, but it breaks JDK8.
I'm more in favor of jumping to JDK21 with spotless/GJF 1.17.0+, as soon as we don't have any module requiring JDK8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbonofre we can't upgrade the GJF as long as we support JDK8 because upgrading the GJF version will produce different results depending on the underlying JDK it is executed with and so CI actions (and locally) will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's my point: I would postpone the JDK21 update right now, and jump directly to JDK21 without supporting JDK8 anymore.
I think it will be very difficult to support both JDK21 and JDK8 from spotless/GJF standpoint. So, I would directly jump to new version when possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping JDK8 support means dropping Hive support (which I'm totally fine with) but we need to properly communicate which Iceberg version will drop Hive support. My understanding was that we were planning to drop Hive support with Iceberg 2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly. It's what I proposed while ago in the Iceberg 2.0 discussion thread. So, I propose:
- on 1.x (including 1.6.0 release currently in preparation), we keep JDK8
- for 2.x, we merge this PR and jump to JDK21
I can reply on the Iceberg 2.0 thread if you want or Piotr can start a new thread about JDK21 on Iceberg 2.0.
I would love to have feedback on the Iceberg 2.0 thread 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping JDK8 support means dropping Hive support (which I'm totally fine with) but we need to properly communicate which Iceberg version will drop Hive support. My understanding was that we were planning to drop Hive support with Iceberg 2.0
Sir. Maybe the iceberg-hive module should be maintained by the hive community in the hive project. Because hive 3.X will EOL sooner or later.
Or just keep the catalog support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BsoBird newer versions of Hive are maintained by the Hive community but the Iceberg community still maintains an older version of Hive
.github/workflows/spark-ci.yml
Outdated
spark: ['3.3', '3.4', '3.5'] | ||
scala: ['2.12', '2.13'] | ||
exclude: | ||
# Spark 3.5 is the first version supporting Java 21 (https://issues.apache.org/jira/browse/SPARK-42369) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually Spark 3.5 does not fully support Java 21, the right ticket is https://issues.apache.org/jira/browse/SPARK-43831
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pan3793 for your comment and the link. This is good reference.
If our tests with Spark 3.5 pass with Java 21, we don't need to disable them, but it's good to know we should be expecting challenges. I will rework the comment.
This is currently the latest Java LTS version, so we should support building with it.
Since spotless plugin is not installed on JDK 21, ./gradlew spotlessApply would fail with
Added spotlessApply stub, for more actionable message:
|
if (JavaVersion.current() == JavaVersion.VERSION_21) { | ||
task spotlessApply { | ||
doLast { | ||
throw new GradleException("Spotless plugin is currently disabled when running on JDK 21 (until we drop JDK 8). To run spotlessApply please use a different JDK version.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for adding that msg, that's going to be helpful
thanks for working on this @findepi |
thanks for the merge! |
This is currently the latest Java LTS version, so we should support
building with it.