Skip to content
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

[SPARK-44112][BUILD][INFRA][DOCS] Drop support for Java 8 and Java 11 #43005

Closed
wants to merge 16 commits into from

Conversation

LuciferYang
Copy link
Contributor

@LuciferYang LuciferYang commented Sep 20, 2023

What changes were proposed in this pull request?

The main purpose of this pr is to remove support for Java 8 and Java 11 in Apache Spark 4.0, the specific work includes:

  1. pom.xml: change java.version from 1.8 to 17, change target:jvm-1.8 to target:17
  2. SparkBuild.scala: change -target:jvm-${javaVersion.value} to -target:${javaVersion.value}
  3. workflow files: change the default Java version from 8 to 17, and ensure that branch-3.x still uses Java 8. Removed the daily job for Java 11 and Java 17.
  4. docs: replace parts of Java 8 and 11 with Java 17.
  5. infra/Dockerfile: change to install openjdk-17-jdk-headless

Why are the changes needed?

The minimum supported Java version for Apache Spark 4.0 is Java 17

Does this PR introduce any user-facing change?

Yes, Apache will no longer support Java 8 and Java 11

How was this patch tested?

  • Pass Github Actions

Was this patch authored or co-authored using generative AI tooling?

No

@LuciferYang LuciferYang marked this pull request as draft September 20, 2023 03:29
@LuciferYang LuciferYang changed the title [SPARK-44112][BUILD][INFRA] Drop Java 8 and 11 support [WIP][SPARK-44112][BUILD][INFRA] Drop Java 8 and 11 support Sep 20, 2023
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @LuciferYang .

@LuciferYang
Copy link
Contributor Author

@dongjoon-hyun I'd like to discuss with you that https://github.com/LuciferYang/spark/actions/runs/6243680485/job/16949769483 has tested Java 17 + Scala 2.12.18, and a lot of tests failed after changing -target:jvm-1.8 to -target:17.

I can reproduce these errors locally,

java -version
openjdk version "17.0.8" 2023-07-18 LTS
OpenJDK Runtime Environment Zulu17.44+15-CA (build 17.0.8+7-LTS)
OpenJDK 64-Bit Server VM Zulu17.44+15-CA (build 17.0.8+7-LTS, mixed mode, sharing)
build/sbt clean "catalyst/test" -Pscala-2.12
[info] LimitPushdownSuite:
[info] org.apache.spark.sql.catalyst.optimizer.LimitPushdownSuite *** ABORTED *** (0 milliseconds)
[info]   java.lang.IllegalAccessError: Update to non-static final field org.apache.spark.SparkFunSuite.invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected attempted from a different method (org$scalatest$BeforeAndAfterAll$_setter_$invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected_$eq) than the initializer method <init>
[info]   at org.apache.spark.SparkFunSuite.org$scalatest$BeforeAndAfterAll$_setter_$invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected_$eq(SparkFunSuite.scala:69)
[info]   at org.scalatest.BeforeAndAfterAll.$init$(BeforeAndAfterAll.scala:148)
[info]   at org.apache.spark.SparkFunSuite.<init>(SparkFunSuite.scala:70)
[info]   at org.apache.spark.sql.catalyst.optimizer.LimitPushdownSuite.<init>(LimitPushdownSuite.scala:29)
[info]   at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[info]   at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
[info]   at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[info]   at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
[info]   at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
[info]   at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
[info]   at java.base/java.lang.Class.newInstance(Class.java:645)
[info]   at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:454)
[info]   at sbt.ForkMain$Run.lambda$runTest$1(ForkMain.java:414)
[info]   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[info]   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[info]   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[info]   at java.base/java.lang.Thread.run(Thread.java:833)
[error] Uncaught exception when running org.apache.spark.sql.catalyst.optimizer.LimitPushdownSuite: java.lang.IllegalAccessError: Update to non-static final field org.apache.spark.SparkFunSuite.invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected attempted from a different method (org$scalatest$BeforeAndAfterAll$_setter_$invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected_$eq) than the initializer method <init> 
[error] sbt.ForkMain$ForkError: java.lang.IllegalAccessError: Update to non-static final field org.apache.spark.SparkFunSuite.invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected attempted from a different method (org$scalatest$BeforeAndAfterAll$_setter_$invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected_$eq) than the initializer method <init> 
[error] 	at org.apache.spark.SparkFunSuite.org$scalatest$BeforeAndAfterAll$_setter_$invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected_$eq(SparkFunSuite.scala:69)
[error] 	at org.scalatest.BeforeAndAfterAll.$init$(BeforeAndAfterAll.scala:148)
[error] 	at org.apache.spark.SparkFunSuite.<init>(SparkFunSuite.scala:70)
[error] 	at org.apache.spark.sql.catalyst.optimizer.LimitPushdownSuite.<init>(LimitPushdownSuite.scala:29)
[error] 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
[error] 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error] 	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
[error] 	at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
[error] 	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
[error] 	at java.base/java.lang.Class.newInstance(Class.java:645)
[error] 	at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:454)
[error] 	at sbt.ForkMain$Run.lambda$runTest$1(ForkMain.java:414)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] 	at java.base/java.lang.Thread.run(Thread.java:833)
...

[info] Run completed in 1 second, 569 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 297
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] *** 297 SUITES ABORTED ***
[error] Error: Total 331, Failed 19, Errors 297, Passed 15
[error] Failed tests:
[error] 	org.apache.spark.sql.catalyst.expressions.RowBasedKeyValueBatchSuite
[error] 	org.apache.spark.sql.connector.catalog.CatalogLoadingSuite
[error] Error during tests:
[error] 	org.apache.spark.sql.catalyst.optimizer.ReassignLambdaVariableIDSuite
[error] 	org.apache.spark.sql.catalyst.plans.logical.AnalysisHelperSuite
...

but when we change the Scala version to Scala 2.13 and then test with Java 17 again,

dev/change-scala-version.sh 2.13
build/sbt clean "catalyst/test" -Pscala-2.13
[info] Run completed in 2 minutes, 16 seconds.
[info] Total number of tests run: 7138
[info] Suites: completed 297, aborted 0
[info] Tests: succeeded 7138, failed 0, canceled 1, ignored 5, pending 0
[info] All tests passed.

all test successful.

If this is the case, can we drop Scala 2.12 supports first, then upgrade the Java version? This seems to be a bit easier.

@dongjoon-hyun
Copy link
Member

+1 for switching to Scala 2.13 first. Please lead the activity. I trust your domain expertise. :)

If this is the case, can we drop Scala 2.12 supports first, then upgrade the Java version? This seems to be a bit easier.

@LuciferYang
Copy link
Contributor Author

+1 for switching to Scala 2.13 first. Please lead the activity. I trust your domain expertise. :)

OK ~

@LuciferYang
Copy link
Contributor Author

wait #43008

@dongjoon-hyun
Copy link
Member

#43008 is merged. Shall we resume this?

@LuciferYang
Copy link
Contributor Author

I'll update this PR later.

@@ -27,7 +27,7 @@ license: |
## Apache Maven

The Maven-based build is the build of reference for Apache Spark.
Building Spark using Maven requires Maven 3.9.4 and Java 8/11/17.
Building Spark using Maven requires Maven 3.9.4 and Java 17.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add Support for Java 8/11 was removed in Spark 4.0.0.

@@ -649,11 +649,11 @@ jobs:
if [ -f ./dev/free_disk_space_container ]; then
./dev/free_disk_space_container
fi
- name: Install Java 8
- name: Install Java 17
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to think about this part a bit more. I just recalled that branch-3.x will also use this yml, so we may need to add some if conditions.

@@ -649,11 +649,11 @@ jobs:
if [ -f ./dev/free_disk_space_container ]; then
./dev/free_disk_space_container
fi
- name: Install Java 8
- name: Install Java ${{ inputs.java }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems easier to install Java this way, the daily test of branch-3.x all with java: 8

@LuciferYang LuciferYang changed the title [WIP][SPARK-44112][BUILD][INFRA] Drop Java 8 and 11 support [WIP][SPARK-44112][BUILD][INFRA][DOCS] Drop Java 8 and 11 support Sep 22, 2023
@LuciferYang LuciferYang changed the title [WIP][SPARK-44112][BUILD][INFRA][DOCS] Drop Java 8 and 11 support [WIP][SPARK-44112][BUILD][INFRA][DOCS] Drop support for Java 8 and Java 11 Sep 22, 2023
@LuciferYang
Copy link
Contributor Author

LuciferYang commented Sep 22, 2023

Work not included in this PR:

  1. Dockerfile: including dev/create-release/spark-rm/Dockerfile and connector/docker/spark-test/base/Dockerfile
  2. appveyor-install-dependencies.ps1: Need to install a Java 17 for windows SparkR test(do independent testing on Test Appveyor use pre-installed java 17 #43054)

Since I can't successfully run docker build -t spark-rm --build-arg UID=$UID on my M2 Max now, I'm posting to verify if my modifications are correct. On the other hand, I also don't know how to install Java 17 in appveyor, so I need to do further investigation.

So, I am planning to create two additional Jira tickets to track these two issues, is that okay?

@LuciferYang LuciferYang changed the title [WIP][SPARK-44112][BUILD][INFRA][DOCS] Drop support for Java 8 and Java 11 [SPARK-44112][BUILD][INFRA][DOCS] Drop support for Java 8 and Java 11 Sep 22, 2023
@LuciferYang
Copy link
Contributor Author

Could you review this @dongjoon-hyun @HyukjinKwon @srowen Thanks

@@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y \
pkg-config \
curl \
wget \
openjdk-8-jdk \
openjdk-17-jdk-headless \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dongjoon-hyun @HyukjinKwon should we change this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Yikun

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dongjoon-hyun So in this PR, should we revert this change and consider it as a followup?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emm, jdk install in here seems useless, because we are using github action to install the java. But if CI passed, it is ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Yikun ~ Let me continue to monitor the running status of GA.

@LuciferYang LuciferYang marked this pull request as ready for review September 22, 2023 09:14
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, the AS-IS PR looks good to me, @LuciferYang . We can do the follow-ups.

  • The Spark release docker files
  • Infra docker files
  • AppVeyor
  • Other documentations including README.md

@dongjoon-hyun
Copy link
Member

IIUC, the main change passed in c0a330d already.

@dongjoon-hyun
Copy link
Member

Merged to master for Apache Spark 4.0.0. Thank you, @LuciferYang and all.

@LuciferYang
Copy link
Contributor Author

Thanks @dongjoon-hyun @HyukjinKwon @bjornjorgensen and @cfmcgrady ~

dongjoon-hyun pushed a commit that referenced this pull request Sep 22, 2023
### What changes were proposed in this pull request?
This pr aims change Maven daily test use Java 17 for testing.

### Why are the changes needed?
#43005 drop support for Java 8 and Java 11, so  Maven daily test should also test with Java 17 as default.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Monitor Maven daily test GA task

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #43057 from LuciferYang/SPARK-45280.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
HyukjinKwon pushed a commit that referenced this pull request Aug 6, 2024
### What changes were proposed in this pull request?

This PR aims to fix `docker-image-tool.sh` to be up-to-date.

### Why are the changes needed?

Apache Spark 4 dropped Java 11 support. So, we should fix the following.
- #43005
```
-  - Build and push Java11-based image with tag "v3.4.0" to docker.io/myrepo
+  - Build and push Java17-based image with tag "v4.0.0" to docker.io/myrepo
```

Apache Spark 4 requires JDK instead of JRE. So, we should fix the following.
- #45761
```
-    $0 -r docker.io/myrepo -t v3.4.0 -b java_image_tag=11-jre build
+    $0 -r docker.io/myrepo -t v4.0.0 -b java_image_tag=17 build
```

Lastly, `3.4.0` is too old because it's released on April 13, 2023. We had better use v4.0.0.
```
-    $0 -r docker.io/myrepo -t v3.4.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
+    $0 -r docker.io/myrepo -t v4.0.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
```

### Does this PR introduce _any_ user-facing change?

No functional change because this is a usage message.

### How was this patch tested?

Manual review.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #47618 from dongjoon-hyun/SPARK-49117.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
fusheng9399 pushed a commit to fusheng9399/spark that referenced this pull request Aug 6, 2024
### What changes were proposed in this pull request?

This PR aims to fix `docker-image-tool.sh` to be up-to-date.

### Why are the changes needed?

Apache Spark 4 dropped Java 11 support. So, we should fix the following.
- apache#43005
```
-  - Build and push Java11-based image with tag "v3.4.0" to docker.io/myrepo
+  - Build and push Java17-based image with tag "v4.0.0" to docker.io/myrepo
```

Apache Spark 4 requires JDK instead of JRE. So, we should fix the following.
- apache#45761
```
-    $0 -r docker.io/myrepo -t v3.4.0 -b java_image_tag=11-jre build
+    $0 -r docker.io/myrepo -t v4.0.0 -b java_image_tag=17 build
```

Lastly, `3.4.0` is too old because it's released on April 13, 2023. We had better use v4.0.0.
```
-    $0 -r docker.io/myrepo -t v3.4.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
+    $0 -r docker.io/myrepo -t v4.0.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
```

### Does this PR introduce _any_ user-facing change?

No functional change because this is a usage message.

### How was this patch tested?

Manual review.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47618 from dongjoon-hyun/SPARK-49117.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
attilapiros pushed a commit to attilapiros/spark that referenced this pull request Oct 4, 2024
### What changes were proposed in this pull request?

This PR aims to fix `docker-image-tool.sh` to be up-to-date.

### Why are the changes needed?

Apache Spark 4 dropped Java 11 support. So, we should fix the following.
- apache#43005
```
-  - Build and push Java11-based image with tag "v3.4.0" to docker.io/myrepo
+  - Build and push Java17-based image with tag "v4.0.0" to docker.io/myrepo
```

Apache Spark 4 requires JDK instead of JRE. So, we should fix the following.
- apache#45761
```
-    $0 -r docker.io/myrepo -t v3.4.0 -b java_image_tag=11-jre build
+    $0 -r docker.io/myrepo -t v4.0.0 -b java_image_tag=17 build
```

Lastly, `3.4.0` is too old because it's released on April 13, 2023. We had better use v4.0.0.
```
-    $0 -r docker.io/myrepo -t v3.4.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
+    $0 -r docker.io/myrepo -t v4.0.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
```

### Does this PR introduce _any_ user-facing change?

No functional change because this is a usage message.

### How was this patch tested?

Manual review.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47618 from dongjoon-hyun/SPARK-49117.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
himadripal pushed a commit to himadripal/spark that referenced this pull request Oct 19, 2024
### What changes were proposed in this pull request?

This PR aims to fix `docker-image-tool.sh` to be up-to-date.

### Why are the changes needed?

Apache Spark 4 dropped Java 11 support. So, we should fix the following.
- apache#43005
```
-  - Build and push Java11-based image with tag "v3.4.0" to docker.io/myrepo
+  - Build and push Java17-based image with tag "v4.0.0" to docker.io/myrepo
```

Apache Spark 4 requires JDK instead of JRE. So, we should fix the following.
- apache#45761
```
-    $0 -r docker.io/myrepo -t v3.4.0 -b java_image_tag=11-jre build
+    $0 -r docker.io/myrepo -t v4.0.0 -b java_image_tag=17 build
```

Lastly, `3.4.0` is too old because it's released on April 13, 2023. We had better use v4.0.0.
```
-    $0 -r docker.io/myrepo -t v3.4.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
+    $0 -r docker.io/myrepo -t v4.0.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
```

### Does this PR introduce _any_ user-facing change?

No functional change because this is a usage message.

### How was this patch tested?

Manual review.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47618 from dongjoon-hyun/SPARK-49117.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
QlikFrederic pushed a commit to Talend/spark that referenced this pull request Nov 11, 2024
The main purpose of this pr is to remove support for Java 8 and Java 11 in Apache Spark 4.0, the specific work includes:
1. `pom.xml`: change `java.version` from 1.8 to 17, change `target:jvm-1.8` to `target:17`
2. `SparkBuild.scala`: change `-target:jvm-${javaVersion.value}` to `-target:${javaVersion.value}`
3. workflow files: change the default Java version from 8 to 17, and ensure that branch-3.x still uses Java 8. Removed the daily job for Java 11 and Java 17.
4. docs: replace parts of Java 8 and 11 with Java 17.

The minimum supported Java version for Apache Spark 4.0 is Java 17

Yes,  Apache will no longer support Java 8 and Java 11

- Pass Github Actions

No

Closes apache#43005 from LuciferYang/SPARK-44112.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants