Skip to content

[SPARK-60669][BUILD][INFRA][DOC] Drop Java 17 Support - #59897

Closed
dongjoon-hyun wants to merge 3 commits into
apache:masterfrom
dongjoon-hyun:SPARK-60669
Closed

dongjoon-hyun wants to merge 3 commits into
apache:masterfrom
dongjoon-hyun:SPARK-60669

Conversation

@dongjoon-hyun

@dongjoon-hyun dongjoon-hyun commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This PR aims to drop Java 17 support in Apache Spark 5.0.0 by making Java 21 the minimum Java version.

  • pom.xml: Change java.version, java.minimum.version, and the -release option of scala-maven-plugin to 21.
  • GitHub Actions: Use Java 21 instead of Java 17 for master. publish_snapshot.yml keeps Java 17 for branch-4.*.
  • GitHub Actions: Turn build_java17.yml and build_maven_java21.yml into no-op placeholders on master like build_scala213.yml, and remove the master badge of build_maven_java21.yml from README.md. master no longer supports Java 17, and build_maven.yml now runs the same Maven build with Java 21. The files are kept because the branch schedulers dispatch them for branch-4.*.
  • Release: Install Java 21 in the master release image, and make release-build.sh reject Java versions older than 21 for Apache Spark 5.0.0 and later.
  • SparkR: Require Java 21 in SystemRequirements, which checkJavaVersion() reads.
  • bin/pyspark: Install JDK 21 instead of JDK 17 when no Java is found.
  • K8s integration tests: Use Java 21 by default in dev-run-integration-tests.sh.
  • Docs: Update the Java version in README.md, docs/index.md, docs/building-spark.md, docs/running-on-yarn.md, docs/security.md, docs/tuning.md, and python/docs/source/getting_started/install.rst.

Why are the changes needed?

The minimum supported Java version for Apache Spark 5.0.0 is Java 21.

Does this PR introduce any user-facing change?

Yes. Apache Spark 5.0.0 requires Java 21 or later. Since all Spark artifacts are compiled for Java 21 (class file version 65), this applies to the client side as well as the cluster runtime. For example, Java 21 is required for:

  • Applications using the Spark Connect JVM client (spark-connect-client-jvm) or the Spark Connect JDBC driver (spark-connect-client-jdbc).
  • Services embedding spark-launcher.
  • Libraries compiled against Apache Spark 5.0.0 artifacts.

The pure-Python Spark Connect client (pyspark-client) is not affected.

How was this patch tested?

Pass the CIs. In addition, I manually verified the following.

  • Maven and SBT reject Java 17, and Test/compile, unidoc, and MiMa pass with Java 21.
  • openjdk-21-jdk-headless installs on the base image of the release image (ubuntu:jammy-20250819), and release-build.sh accepts it for 5.0.0-SNAPSHOT while rejecting Java 17 for Apache Spark 5.0.0.
  • All workflow files parse, their names are unique, and every workflow that the branch schedulers dispatch still has workflow_dispatch.
  • The new SystemRequirements of SparkR, parsed the same way as checkJavaVersion(), rejects Java 17 and accepts Java 21 and 25.

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

Generated-by: Claude Opus 5.5

@dongjoon-hyun

dongjoon-hyun commented Oct 28, 2026 •

Copy link
Copy Markdown
Member Author

@spark-test spark-test left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review summary

The core baseline change is consistent. java.version and java.minimum.version drive maven.compiler.release, the javac --release argument, the enforcer's requireJavaVersion and bytecode ceiling, and SBT's checkJavaVersion, and the scalac -release literal moves with them, so both builds reject JDK 17 with an explicit message. The CI defaults, publish_snapshot.yml's per-branch JDK selection, and the updated documentation pages agree with the new minimum.

The findings with the most direct impact sit outside the build itself:

  • The master release image and its Java guard would make the scheduled release.yml dry run and default 5.0.0 release builds fail at the enforcer.
  • SparkR's Java check would admit Java 17 and end in a misleading backend-launch failure.
  • bin/pyspark would install JDK 17 for users who have no Java.
  • HiveExternalCatalogVersionsSuite would silently stop testing prior releases on master CI.

The remaining findings are lower-impact workflow, developer-tooling, benchmark, notebook-image, and documentation updates.

Cross-cutting observations

  • This PR moves the Java baseline in pom.xml, the CI workflow defaults, and five documentation pages, but the Java 17 minimum is also restated outside those files. It still appears in the master release image and its Java guard, SparkR's DESCRIPTION, the bin/pyspark JDK installer, the binder and local docs images, the Kubernetes integration-test dev script, the master Java 17 workflow, the HiveExternalCatalogVersionsSuite gate, the BenchmarkBase baseline threshold, and the YARN and tuning guides. The previous baseline bump to Java 17 (SPARK-44112) moved the same kinds of consumers through companion changes in the same week, for example SPARK-45284 for SparkR and SPARK-45281 for BenchmarkBase. Handling these here, or as tracked SPARK-60669 subtasks before 5.0.0, would keep the release, launch, test, and documentation surfaces consistent with the new minimum.
    Separation: Each consumer restates the minimum independently, and each fix is a self-contained edit with no ordering or runtime coupling. Completing the individual repairs satisfies the shared baseline without a common owner, so the pattern changes no repair's scope, grouping, or severity.

Findings

12 total: 0 P0, 0 P1, 4 P2, 8 P3.

Non-blocking (P2)

  • Master release image and guard still use Java 17 — pom.xml:124
    The master release tooling still provides and accepts Java 17. dev/create-release/spark-rm/Dockerfile (the 'Spark master (5.0.0-SNAPSHOT) release image') installs only openjdk-17-jdk-headless, Dockerfile.base installs no JDK, and do-release.sh sets JAVA_HOME=/usr inside the container. release.yml runs a scheduled dry run on apache/spark every two days against master through do-release-docker.sh -n without -j. After this change every dry run, and any default 5.0.0 preview or RC build, fails at requireJavaVersion 21. release-build.sh (lines 692-695) still lets Java 17 through for Spark 4.0+, and the -j help text in do-release-docker.sh still names openjdk17. SPARK-45276 updated the same Dockerfile and script when the baseline last moved. Branch releases use their own copies, so only master's files need to change.

    Verification:

    • Behavior: A release dry run using the master release image without an external JDK reaches and completes the Maven package step on JDK 21.
    • Regression: Running the release build for a 5.x version with a JDK 17 JAVA_HOME stops at the release Java-version guard with an explicit Java 21 requirement, instead of failing later in the Maven enforcer.
    • Inspection: The master release image definition and the release script usage text no longer name Java 17 as the build JDK.
  • SparkR still declares and enforces Java 17 minimum — pom.xml:125 — see inline.

  • bin/pyspark auto-installs JDK 17, which cannot run Spark 5.0 — pom.xml:124
    bin/pyspark (lines 52-73) still provisions Java 17. When JAVA_HOME is unset and no java is on PATH, it offers to 'install JDK 17', calls jdk.install("17"), exports that JAVA_HOME, and bin/spark-class then runs org.apache.spark.launcher.Main on it. With this change the launcher is compiled for release 21, so a pip user without Java who answers Y gets UnsupportedClassVersionError and no shell, and the decline message still says 'JDK (17 or later)'. The script ships in the PyPI package (pyspark.bin), so this is the supported first-run path. The prompt, the comment, the jdk.install call, and the message all need to move to 21.

    Verification:

    • Regression: In an environment without JAVA_HOME or java, accepting the pyspark JDK prompt installs JDK 21 and the shell starts a SparkSession.
    • Inspection: The pyspark launcher script no longer names JDK 17 in its prompt, install call, comment, or decline message.
  • HiveExternalCatalogVersionsSuite becomes vacuous on master CI — .github/workflows/build_and_test.yml:28 — see inline.

Nit (P3)

  • BenchmarkBase still treats JDK 17 as the unsuffixed baseline — .github/workflows/benchmark.yml:35 — see inline.

  • YARN guide still states a Java 17 baseline — docs/index.md:37 — see inline.

  • Binder Live Notebook image still ships only JRE 17 — pom.xml:124
    The binder image behind the PySpark docs' Live Notebook links still installs openjdk-17-jre as its only JVM (binder/Dockerfile:39). On a tagged commit, binder/postBuild installs exactly that PySpark version, and the docs build those links from the GIT_HASH revision. So once a 5.x preview, RC, or final tag exists, the notebooks install PySpark 5.x and fail at SparkSession creation with UnsupportedClassVersionError; untagged master hides this because the <= specifier installs an older release. The image needs a Java 21 runtime. Which Java 21 package the python:3.11-slim base can install depends on its Debian release, which was not verified here.

    Verification:

    • Behavior: Building the Live Notebook image from a commit that installs PySpark 5.x and running the DataFrame quickstart creates a SparkSession without a class-version failure.
  • Local containerized docs build still runs on JDK 17 — pom.xml:124
    The local docs utility now mixes a Java 21 host build with a Java 17 container. build-docs compiles Spark on the host, which now requires and emits Java 21 classes, and then runs run-in-container inside the dev/spark-test-image/docs image, which installs only openjdk-17-jdk-headless and whose script exports JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64. With SPARK_DOCS_IS_BUILT_ON_HOST=1 the SBT steps are skipped, but sql/create-docs.sh still calls bin/spark-submit in the container, which fails on the Java 21 class files and aborts with 'SQL doc generation failed'. CI's docs job is unaffected because it installs inputs.java. The image's ubuntu:noble base provides a JDK 21 package, so the image and JAVA_HOME can both move to 21.

    Verification:

    • Behavior: Running the containerized local docs build end to end produces the documentation, including the SQL API docs, without a Java class-version failure.
    • Compatibility: The CI documentation job, which installs its own JDK, still builds the docs with the updated image.
  • K8s integration-test dev script overrides java.version to 17 — pom.xml:124 — see inline.

  • build_maven.yml now duplicates build_maven_java21.yml — .github/workflows/build_maven.yml:20 — see inline.

  • build_java17.yml remains a live Java 17 master build — pom.xml:124
    .github/workflows/build_java17.yml still defines a real Java 17 build on master. It is dispatch-only and calls build_and_test.yml with java: 17 and no branch input, so the build defaults to master, which SBT's checkJavaVersion and Maven's requireJavaVersion now reject. A master dispatch can only fail, and future branch cuts inherit master's copy. The file has to stay on master for the branch schedulers' --ref branch-* dispatches and the README badges. The repository already handles that case with no-op placeholders (build_scala213.yml, build_python_3.9.yml, build_python_pypy3.10.yml), and converting this file the same way keeps branch dispatch and badges working.

    See Shared repair plan 2 in the review body.

  • Tuning guide still says Spark uses JDK 17 by default — docs/index.md:37
    docs/tuning.md:235 still says 'Since 4.0.0, Spark uses JDK 17 by default, which also makes the G1GC garbage collector the default.' Spark 5.0 can no longer run on JDK 17, so the 5.0 tuning guide now states the wrong default runtime. The G1GC advice is still valid on JDK 21, so only the version statement needs to change.

    See Shared repair plan 1 in the review body.

Shared repair plans

Shared repair plan 1

Covered findings:

  • YARN guide still states a Java 17 baseline — docs/index.md:37
  • Tuning guide still says Spark uses JDK 17 by default — docs/index.md:37

Verification:

  • Inspection: The YARN and tuning guides state the Java 21 minimum consistently with the supported-runtime statement on the documentation index, and the YARN JDK example no longer uses a Java 17 path.

Shared repair plan 2

Covered findings:

  • build_maven.yml now duplicates build_maven_java21.yml — .github/workflows/build_maven.yml:20
  • build_java17.yml remains a live Java 17 master build — pom.xml:124

Verification:

  • Inspection: On master, the Java 17 and Maven JDK 21 workflow files contain only a workflow_dispatch trigger and a no-op job, every workflow display name is unique, and the README master table lists one Maven JDK 21 build.
  • Compatibility: The release-branch schedulers can still dispatch both workflows by release ref, and the branch-4.x and branch-4.3 README badges for them still resolve.

Generated by Omnigent on Databricks

Comment thread pom.xml
<java.version>17</java.version>
<java.minimum.version>17.0.11</java.minimum.version>
<java.version>21</java.version>
<java.minimum.version>21</java.minimum.version>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking (P2): R/pkg/DESCRIPTION:13 still declares SystemRequirements: Java (>= 17, < 26), and SparkR's checkJavaVersion() (R/pkg/R/client.R) reads its lower bound from that field before sparkR.session() launches the backend. With the minimum now 21, a SparkR user on Java 17 passes the guard. The spark-submit launcher, compiled for release 21, then fails with UnsupportedClassVersionError, and SparkR ends with the misleading JVM is not ready after 10 seconds instead of its explicit 'Java version ... is required' error. The package metadata also misstates the minimum. The previous baseline bump moved this field in a same-day companion change, SPARK-45284; Java (>= 21, < 26) restores the guard.

Verification:

  • Regression: With a Java 17 runtime, starting a SparkR session fails at SparkR's Java version check with the explicit minimum-21 message, not with a backend launch failure.
  • Compatibility: With Java 21 and Java 25 runtimes, the SparkR Java version check passes and sessions start as before.

required: false
type: string
default: 17
default: 21

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking (P2): Moving this default to 21 silently disables HiveExternalCatalogVersionsSuite. The suite is @SlowHiveTest and runs in the 'hive - slow tests' entries here and in maven_test.yml with java: ${{ inputs.java }}. PROCESS_TABLES.testingVersions is non-empty only when Utils.isJavaVersionAtMost17 (lines 264-266), and test("backward compatibility") calls runSparkSubmit only when it is non-empty (line 250). No master job can run on Java 17 any more, so every run logs 'Skip tests because old Spark versions don't support Java 21' and passes without testing anything. Master loses its automated check that tables and metadata written by released Spark versions stay readable through HiveExternalCatalog, a main 5.0 upgrade path. Released 4.x lines run on Java 21, so the gate can select the latest release of each line that supports the running JDK instead of returning nothing.

Verification:

  • Regression: Running the Hive external catalog backward-compatibility suite on Java 21 exercises at least one prior release line, instead of logging the Java 21 skip and passing vacuously.
  • Compatibility: Release lines that cannot run on the current JDK, such as 3.5.x on Java 21, are excluded, so the suite does not fail spuriously.

default: '17'
default: '21'
options:
- '17'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit (P3): Without the JDK 17 option, nothing can regenerate the unsuffixed baseline files. BenchmarkBase.scala:55 still suffixes result files only when version > 17, so every run this workflow can launch writes -jdk21 or -jdk25 files. The 126 committed unsuffixed *-results.txt files, 125 of which report a JDK 17 VM (for example KryoBenchmark-results.txt), stay frozen as JDK 17 snapshots that still look like the default baseline, and the scaladocs that say results go to benchmarks/<Name>-results.txt describe files no supported run writes. When the baseline last moved, SPARK-45281 changed this threshold from > 8 to > 17 and companion changes refreshed and pruned the result files; moving it to > 21 follows the same pattern.

Verification:

  • Behavior: Regenerating a benchmark on JDK 21 writes the unsuffixed result file, and regenerating it on JDK 25 writes the jdk25-suffixed file.
  • Inspection: No committed unsuffixed benchmark result file names a JDK 17 VM in its header, and no orphaned jdk21-suffixed duplicates remain.

Comment thread docs/index.md
Spark runs on both Windows and UNIX-like systems (e.g. Linux, Mac OS), and it should run on any platform that runs a supported version of Java. This should include JVMs on x86_64 and ARM64. It's easy to run locally on one machine --- all you need is to have `java` installed on your system `PATH`, or the `JAVA_HOME` environment variable pointing to a Java installation.

Spark runs on Java 17/21/25, Scala 2.13, Python 3.11+, and R 4.0+ (Deprecated).
Spark runs on Java 21/25, Scala 2.13, Python 3.11+, and R 4.0+ (Deprecated).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit (P3): docs/running-on-yarn.md still contradicts this line. Line 36 says 'Apache Spark requires at least Java 17 since 4.0.0' and asks for a separate JDK only when Hadoop is older than 3.5.0, and the JDK example at lines 1072-1078 points JAVA_HOME, spark.yarn.appMasterEnv.JAVA_HOME, and spark.executorEnv.JAVA_HOME at /opt/openjdk-17. A user who follows that page on a cluster whose nodes run Java 17 gets an ApplicationMaster and executors that cannot load Spark 5.0's Java 21 classes. The baseline sentence, the Hadoop condition, and the example path need to reflect Java 21.

See Shared repair plan 1 in the review body.

Comment thread pom.xml
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<java.minimum.version>17.0.11</java.minimum.version>
<java.version>21</java.version>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit (P3): The Kubernetes integration-test dev script still overrides this property to 17. resource-managers/kubernetes/integration-tests/dev/dev-run-integration-tests.sh:41 defaults JAVA_VERSION="17", and line 145 passes -Djava.version=$JAVA_VERSION to its build/mvn install ... -am build. That replaces java.version=21 in maven.compiler.release, the javac --release argument, requireJavaVersion, and the enforceBytecodeVersion ceiling, while the scalac -release literal further down stays 21. A default developer run therefore compiles Java sources for release 17 and Scala sources for release 21, which matches neither the shipped build nor anything CI runs. Whether the release-17 bytecode ceiling also rejects the release-21 reactor jars was not verified without a Maven build. A default of 21 keeps the script consistent with the POM.

Verification:

  • Behavior: With default arguments, the Kubernetes integration-test dev build compiles Java and Scala classes for the same release 21 target as the shipped build.

#

name: "Build / Maven (Scala 2.13, JDK 17)"
name: "Build / Maven (Scala 2.13, JDK 21)"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit (P3): This name is already used by build_maven_java21.yml, and after the default change the two workflows are the same build. Apart from cron (0 13 vs 0 14, every two days), they differ only in build_maven_java21.yml's explicit java: 21, which is now maven_test.yml's default. So master runs two identical full Maven JDK 21 test jobs under one display name, and the README master table shows both badges. The branch schedulers dispatch both files with --ref branch-*, so neither can simply be deleted. Turning master's build_maven_java21.yml into a no-op placeholder like build_scala213.yml, with a distinct display name and without the duplicate README badge, removes the duplicate run and keeps branch dispatch and badges working.

See Shared repair plan 2 in the review body.

@sarutak sarutak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The pom.xml, SBT, and CI default changes look correct to me. Here are a few points that are not covered by the existing review.

  1. Could you expand the user-facing section of the PR description a little? No module overrides java.version or maven.compiler.release, so all published jars now target class file version 65. This means Java 21 is also required on the client side, not only for the cluster runtime: for example, applications using the Spark Connect JVM client (spark-connect-client-jvm) or the Connect JDBC driver, services embedding spark-launcher, and libraries compiled against the Spark 5.0 artifacts with JDK 17. The pure-Python pyspark-client is not affected. Since this section becomes part of the commit message, mentioning these would help downstream users.

  2. In addition to docs/tuning.md:235 mentioned in the other review, the same page still links to the Java 17 docs at lines 44, 47, 49, and 246 (https://docs.oracle.com/en/java/javase/17/...). This PR already updates the same kind of links in docs/security.md, so it may be natural to update them here as well.

  3. Users who run Spark 4.x on Java 17 will see some query results change when they move to Spark 5.0, because of JDK behavior changes that the .java21 golden files already capture. It would be helpful to note them in the migration guide (here or in a follow-up):

    • Float/Double to string conversion now produces the shortest representation (JDK-4511638), so the last digits can differ, e.g. 4.6116860184273879E18 becomes 4.611686018427388E18. This also shows up in values derived from the string form, e.g. one result in postgreSQL/numeric.sql changes from 107511333880051872.0000000000 to 107511333880051870.0000000000.
    • The 'F' pattern in date_format / to_char now returns the day-of-week-in-month correctly (JDK-8282081), e.g. 5 instead of 3 for 2019-12-31.

For the SPARK-60669 follow-up subtasks suggested in the other review, here are a few more items I found:

  • .java21 golden files: SQLQueryTestSuite and ThriftServerQueryTestSuite use *.sql.out.java21 when running on Java 21+ (7 files, e.g. postgreSQL/float4.sql.out.java21). Since CI now runs only on Java 21 and 25, the corresponding base .sql.out files are no longer compared or regenerated, and they will silently become stale. We could promote the .java21 contents to the base files and remove the suffix handling.
  • Java version branches that become dead code, other than the ones already mentioned: the Hive 4.2 Java 21 check in IsolatedClientLoader, HiveClientVersions, WriteAheadLogSuite, the Java 17.0.14 branch in UtilsSuite, and the javaVersion >= 18 condition in ClosureCleaner. This is similar to SPARK-45874 and SPARK-45802 after the previous baseline bump.
  • Besides dev/spark-test-image/docs, the 9 dev/spark-test-image/python-* images still install openjdk-17-jdk-headless. CI is not affected because setup-java overrides it, but the default java in those images is still 17 when they are used locally.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you for the review, @sarutak.

  • I updated the user-facing section of the PR description as you suggested.
  • I updated the Java 17 links and the JDK statement in docs/tuning.md.
  • I'd like to handle the migration guide notes in a separate PR, together with the other items in your list.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you for the review. This PR now also addresses the following.

  • The master release image installs Java 21, and release-build.sh rejects Java versions older than 21 for Apache Spark 5.0.0 and later.
  • SparkR's SystemRequirements requires Java 21.
  • bin/pyspark installs JDK 21.
  • dev-run-integration-tests.sh uses Java 21 by default.
  • The YARN and tuning guides state Java 21.
  • build_java17.yml and build_maven_java21.yml are no-op placeholders on master.

I'll handle HiveExternalCatalogVersionsSuite, BenchmarkBase, and the Binder and docs images in separate PRs.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Also, rebase to master~

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Since the dev mailing list discussion seems to reach a consensus, could you review this once more, please, @sarutak ?

@pan3793

pan3793 commented Nov 3, 2026

Copy link
Copy Markdown
Member

New Findings

  1. dev/create-release/release-build.sh:696: Nit: For Spark 5 with Java 8, this branch is unreachable. The preceding JAVA_VERSION < "17.0." && SPARK_VERSION > "3.5.99" check matches and exits with "required 17", even though 5.0 requires 21. Move the 5.0+ check before the 4.x check, or bound the 4.x check below 4.99.

  2. resource-managers/kubernetes/integration-tests/README.md:145: Nit: dev-run-integration-tests.sh now defaults JAVA_VERSION to 21, but this line still documents 17. Update the documented default to match.

  3. sql/core/src/main/java/org/apache/spark/sql/execution/datasources/v2/ffi/NativeLibrary.java:46: Nit: Spark now compiles for Java 21. The final FFM API still starts at Java 22, but the compile target in this sentence is stale. Update this and the same current-state references in .github/workflows/build_and_test.yml:956, project/SparkBuild.scala:257, dev/scalastyle:36, and R/pkg/R/client.R:97.

Still Open

  1. sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveExternalCatalogVersionsSuite.scala:265: P2: With the master default now Java 21, Utils.isJavaVersionAtMost17 makes testingVersions empty, so this suite logs the Java 21 skip and passes without exercising any prior release. Select the latest release per line that supports the running JDK instead of returning an empty sequence.

  2. .github/workflows/benchmark.yml:35: Nit: Removing the JDK 17 run leaves BenchmarkBase.scala:55 treating 17 as the unsuffixed baseline. Every run this workflow can launch writes -jdk21 or -jdk25 results and cannot regenerate the unsuffixed JDK 17 baselines. Move the threshold to 21 and refresh or prune the result files as in the previous baseline bump.

  3. pom.xml:124: P3: Java 17 remains the only runtime in local and docs containers: binder/Dockerfile:39, dev/spark-test-image/docs/Dockerfile:60, dev/spark-test-image-util/docs/run-in-container:19, and the dev/spark-test-image/python-* images. They will fail against Java 21 artifacts when used outside CI. Update them with this baseline bump.

@dongjoon-hyun

dongjoon-hyun commented Nov 3, 2026 •

Copy link
Copy Markdown
Member Author

Thank you, @pan3793 . For me, your review bot setting seems to be a little suspicious. For the Open items you mentioned (HiveExternalCatalogVersionsSuite and Benchmark), I already mentioned I will handle them seperately. WDYT?

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

It's unreasonable to put everything in a single PR. Especially, Benchmark and release scripts should be tested carefully and manually verified. I clearly documented that from the beginning, @pan3793 .

@viirya viirya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The core change looks right to me. A few small things the previous reviews did not cover are inline. Two more are outside the diff:

  • .github/workflows/build_and_test.yml:955-956 still says "the other jobs, on Java 17, skip the tests that load a library", and the class doc of NativeLibrary.java:46 says "Spark compiles for Java 17". Both should say 21 now. The logic still holds, since the FFM API is final only in Java 22.
  • For the dead-branch follow-up: Utils.isJavaVersionAtLeast21 in RestSubmissionServer (spark.master.rest.virtualThread.enabled) and its check in StandaloneRestSubmitSuite are now always true.

Master loses the HiveExternalCatalogVersionsSuite backward-compatibility check as soon as this merges, so it would be good to track that as a SPARK-60669 subtask before 5.0.0.

EXCLUDE_TAGS=
DEFAULT_EXCLUDE_TAGS="N/A"
JAVA_VERSION="17"
JAVA_VERSION="21"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

resource-managers/kubernetes/integration-tests/README.md:145 still says the default of --java-version is 17.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you. I updated the default in README.md too.

packages: write
name: Run
uses: ./.github/workflows/build_and_test.yml
noop:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this file and build_maven_java21.yml get a header comment like the one in build_scala213.yml? Without it, nothing says that the README badges and the branch4*_scheduler.yml dispatches (--ref branch-4.*) depend on these files staying on master, and they look safe to delete.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you. I added a placeholder header to both files like build_scala213.yml. It also mentions the branch4*_scheduler.yml dispatches.

Comment thread docs/tuning.md Outdated
occupies 2/3 of the heap. It should be large enough such that this fraction exceeds `spark.memory.fraction`.

* Since 4.0.0, Spark uses JDK 17 by default, which also makes the G1GC garbage collector the default. Note that with
* Since 5.0.0, Spark uses JDK 21 by default, which also makes the G1GC garbage collector the default. Note that with

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This reads as if G1 became the default in 5.0. G1 has been the JVM default since JDK 9, and 21 is the minimum rather than a default Spark picks. Maybe: "Spark requires JDK 21 or later, where G1GC is the default garbage collector."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you. I used your wording.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you, @viirya , too.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

For the record, BenchmarkBase is currently handled in this way at the first commit. I'll regenerate all to fill the missing files after merging this PR and #60046 .

@pan3793

pan3793 commented Nov 3, 2026

Copy link
Copy Markdown
Member

For me, your review bot setting seems to be a little suspicious.

@dongjoon-hyun, yeah, the review comment was generated by an LLM, and I reviewed it and tuned/filtered out several items before posting.

For the Open items you mentioned (HiveExternalCatalogVersionsSuite and Benchmark), I already mentioned I will handle them seperately. WDYT?

I didn't read the whole PR description and review history manually because it's too long ... and absolutely, handling them separately is fine.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you, @pan3793 .

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you for the review, @viirya.

  • I updated the FFM comments in build_and_test.yml and NativeLibrary.java. Since the FFM API is still in preview in Java 21, NativeLibrary.java now says so instead of saying that the API does not exist.
  • I'll remove the always-true Utils.isJavaVersionAtLeast21 branches in RestSubmissionServer and StandaloneRestSubmitSuite together with the other Java version branches in a separate PR.
  • Yes, I'll handle HiveExternalCatalogVersionsSuite in a separate PR before 5.0.0.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you for the new findings, @pan3793.

  1. I moved the 5.0+ check before the 4.0+ check in release-build.sh, so every Java version older than 21 now gets the required 21 message for Apache Spark 5.0.0.
  2. I updated the documented default in the Kubernetes integration test README.md.
  3. I updated build_and_test.yml and NativeLibrary.java. The Java 17/25 Maven build in project/SparkBuild.scala and dev/scalastyle refers to a CI job that SPARK-57514 already removed, so it is not related to this PR. R/pkg/R/client.R describes the version string formats that checkJavaVersion() parses, including the old versions that it rejects, so it is still valid.

@pan3793 pan3793 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you for making this move forward, @pan3793 .

@sarutak sarutak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for the update, @dongjoon-hyun. The PR description and docs/tuning.md now cover my points, and handling the migration guide notes and the other follow-up items in separate PRs sounds good to me. The new changes (the release image and the release-build.sh guard, SparkR, bin/pyspark, the placeholder workflows, and the docs) also look good. LGTM.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you, @sarutak !

@dongjoon-hyun

dongjoon-hyun commented Nov 3, 2026 •

Copy link
Copy Markdown
Member Author

For the records, HiveExternalCatalogVersionsSuite is handled in the following PR.

@viirya viirya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the updates, @dongjoon-hyun. LGTM.

@LuciferYang LuciferYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you, @viirya and @LuciferYang .

@peter-toth peter-toth left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR, @dongjoon-hyun!

The build, CI and release changes move the baseline consistently in both Maven and SBT. The Java 17 images left behind (binder, the docs image and the python-* images) are already raised in the spark-test review and sarutak's review. You deferred them to follow-ups in this comment. I have one addition on the YARN guide.

Non-blocking

  • 1. YARN shuffle service needs a Java 21 NodeManager: the shuffle service jar is compiled for Java 21 too, and it runs inside the NodeManager JVM. The "configure a different JDK for Spark applications" advice doesn't cover it, so the guide should say the NodeManagers need Java 21. inline

Comment thread docs/running-on-yarn.md
# Launching Spark on YARN

Apache Hadoop supports Java 17 since 3.5.0, while Apache Spark requires at least Java 17 since 4.0.0. When running on a YARN cluster whose Hadoop version is older than 3.5.0, a different JDK should be configured for Spark applications.
Apache Spark requires at least Java 21 since 5.0.0. When running on a YARN cluster with a Java version older than 21, a different JDK should be configured for Spark applications.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Finding 1. The YARN external shuffle service is compiled for Java 21 as well, since common/network-yarn doesn't override java.version. It doesn't run in a Spark container. It runs inside the NodeManager JVM, since the "Configuring the External Shuffle Service" section adds spark-<version>-yarn-shuffle.jar to the NodeManager classpath. So setting JAVA_HOME for the AM and the executors doesn't help it, and a NodeManager on Java 17 can't load YarnShuffleService (class file version 65). The guide used to describe running YARN itself on Java 17 with Hadoop 3.5.0, so such clusters are likely.

Could this paragraph say so? For example:

Suggested change
Apache Spark requires at least Java 21 since 5.0.0. When running on a YARN cluster with a Java version older than 21, a different JDK should be configured for Spark applications.
Apache Spark requires at least Java 21 since 5.0.0. When running on a YARN cluster with a Java version older than 21, a different JDK should be configured for Spark applications. This does not apply to the [external shuffle service](#configuring-the-external-shuffle-service), which runs inside the NodeManager JVM, so the NodeManagers must run on Java 21 or later to use it.

It would also fit the user-facing list in the PR description, next to spark-launcher.

@dongjoon-hyun

dongjoon-hyun commented Nov 3, 2026 •

Copy link
Copy Markdown
Member Author

Thank you, @peter-toth . However, that's orthogonal to this PR because Apache Spark 4.0 (built on Java 17) had the same incompatibility on YARN cluster (on Java 8). Let's proceed your suggestion independently because it should be backported to branch-4.x and older branch.

In other words, common/network-yarn has always followed the Spark-wide java.version, so the shuffle service has required Java 17 NodeManagers since Apache Spark 4.0.0, when Hadoop 3.4 still ran on Java 8 and 11, and the guide has not mentioned it. This PR only changes the version from 17 to 21.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Here is the PR for your request, @peter-toth .

dongjoon-hyun added a commit that referenced this pull request Nov 3, 2026
… Java version for the Spark Shuffle Service

### What changes were proposed in this pull request?

This PR adds a paragraph to the `Configuring the External Shuffle Service` section of `docs/running-on-yarn.md`. It states that:
- the Spark Shuffle Service runs inside the `NodeManager` JVM, so all `NodeManager`s must run on a supported version of Java, and
- unlike Spark applications, the shuffle service cannot use a different JDK from the `NodeManager`.

The paragraph links the supported Java versions in `docs/index.md` instead of naming a Java version, so the same text stays correct when the minimum Java version changes.

### Why are the changes needed?

`spark-<version>-yarn-shuffle.jar` is built from `common/network-yarn`, which does not override `java.version`. So its classes target the minimum Java version of Apache Spark, which is Java 17 since Apache Spark 4.0.0. For example, `YarnShuffleService.class` has the class file major version 61 in the 4.0.4, 4.1.3, 4.2.0, and 4.3.0 binary distributions. A `NodeManager` on an older Java cannot load `org.apache.spark.network.yarn.YarnShuffleService`.

The guide explains how to use a different JDK for Spark applications when the YARN cluster runs an older Java (`Configuring different JDKs for Spark Applications`). That sets `JAVA_HOME` of the AM and the executors only, and does not help the shuffle service, which the `NodeManager` loads as an auxiliary service. However, the guide has never mentioned the Java requirement of the `NodeManager`s. For example, the [v4.0.0](https://github.com/apache/spark/releases/tag/v4.0.0) (2025-05-19) guide said `Apache Hadoop does not support Java 17 as of 3.4.1`, while its `Configuring the External Shuffle Service` section had no Java requirement.

This was raised in the review of #59897 (#59897 (comment)), which makes Java 21 the minimum in Apache Spark 5.0.0. The documentation gap is independent of #59897 because it exists since Apache Spark 4.0.0.

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

No. This is a documentation-only change.

### How was this patch tested?

Manual review.
- Both link targets already exist: the `Downloading` section of `index.md`, which lists the supported Java versions, and the `Configuring different JDKs for Spark Applications` section, which the same page already links at the top.
- The class file versions above were read from `yarn/spark-<version>-yarn-shuffle.jar` of the binary distributions.

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

Generated-by: Claude Opus 5.5

Closes #60052 from dongjoon-hyun/SPARK-60837.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Nov 3, 2026
… Java version for the Spark Shuffle Service

### What changes were proposed in this pull request?

This PR adds a paragraph to the `Configuring the External Shuffle Service` section of `docs/running-on-yarn.md`. It states that:
- the Spark Shuffle Service runs inside the `NodeManager` JVM, so all `NodeManager`s must run on a supported version of Java, and
- unlike Spark applications, the shuffle service cannot use a different JDK from the `NodeManager`.

The paragraph links the supported Java versions in `docs/index.md` instead of naming a Java version, so the same text stays correct when the minimum Java version changes.

### Why are the changes needed?

`spark-<version>-yarn-shuffle.jar` is built from `common/network-yarn`, which does not override `java.version`. So its classes target the minimum Java version of Apache Spark, which is Java 17 since Apache Spark 4.0.0. For example, `YarnShuffleService.class` has the class file major version 61 in the 4.0.4, 4.1.3, 4.2.0, and 4.3.0 binary distributions. A `NodeManager` on an older Java cannot load `org.apache.spark.network.yarn.YarnShuffleService`.

The guide explains how to use a different JDK for Spark applications when the YARN cluster runs an older Java (`Configuring different JDKs for Spark Applications`). That sets `JAVA_HOME` of the AM and the executors only, and does not help the shuffle service, which the `NodeManager` loads as an auxiliary service. However, the guide has never mentioned the Java requirement of the `NodeManager`s. For example, the [v4.0.0](https://github.com/apache/spark/releases/tag/v4.0.0) (2025-05-19) guide said `Apache Hadoop does not support Java 17 as of 3.4.1`, while its `Configuring the External Shuffle Service` section had no Java requirement.

This was raised in the review of #59897 (#59897 (comment)), which makes Java 21 the minimum in Apache Spark 5.0.0. The documentation gap is independent of #59897 because it exists since Apache Spark 4.0.0.

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

No. This is a documentation-only change.

### How was this patch tested?

Manual review.
- Both link targets already exist: the `Downloading` section of `index.md`, which lists the supported Java versions, and the `Configuring different JDKs for Spark Applications` section, which the same page already links at the top.
- The class file versions above were read from `yarn/spark-<version>-yarn-shuffle.jar` of the binary distributions.

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

Generated-by: Claude Opus 5.5

Closes #60052 from dongjoon-hyun/SPARK-60837.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 152e072)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Nov 3, 2026
… Java version for the Spark Shuffle Service

### What changes were proposed in this pull request?

This PR adds a paragraph to the `Configuring the External Shuffle Service` section of `docs/running-on-yarn.md`. It states that:
- the Spark Shuffle Service runs inside the `NodeManager` JVM, so all `NodeManager`s must run on a supported version of Java, and
- unlike Spark applications, the shuffle service cannot use a different JDK from the `NodeManager`.

The paragraph links the supported Java versions in `docs/index.md` instead of naming a Java version, so the same text stays correct when the minimum Java version changes.

### Why are the changes needed?

`spark-<version>-yarn-shuffle.jar` is built from `common/network-yarn`, which does not override `java.version`. So its classes target the minimum Java version of Apache Spark, which is Java 17 since Apache Spark 4.0.0. For example, `YarnShuffleService.class` has the class file major version 61 in the 4.0.4, 4.1.3, 4.2.0, and 4.3.0 binary distributions. A `NodeManager` on an older Java cannot load `org.apache.spark.network.yarn.YarnShuffleService`.

The guide explains how to use a different JDK for Spark applications when the YARN cluster runs an older Java (`Configuring different JDKs for Spark Applications`). That sets `JAVA_HOME` of the AM and the executors only, and does not help the shuffle service, which the `NodeManager` loads as an auxiliary service. However, the guide has never mentioned the Java requirement of the `NodeManager`s. For example, the [v4.0.0](https://github.com/apache/spark/releases/tag/v4.0.0) (2025-05-19) guide said `Apache Hadoop does not support Java 17 as of 3.4.1`, while its `Configuring the External Shuffle Service` section had no Java requirement.

This was raised in the review of #59897 (#59897 (comment)), which makes Java 21 the minimum in Apache Spark 5.0.0. The documentation gap is independent of #59897 because it exists since Apache Spark 4.0.0.

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

No. This is a documentation-only change.

### How was this patch tested?

Manual review.
- Both link targets already exist: the `Downloading` section of `index.md`, which lists the supported Java versions, and the `Configuring different JDKs for Spark Applications` section, which the same page already links at the top.
- The class file versions above were read from `yarn/spark-<version>-yarn-shuffle.jar` of the binary distributions.

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

Generated-by: Claude Opus 5.5

Closes #60052 from dongjoon-hyun/SPARK-60837.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 152e072)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Nov 3, 2026
… Java version for the Spark Shuffle Service

### What changes were proposed in this pull request?

This PR adds a paragraph to the `Configuring the External Shuffle Service` section of `docs/running-on-yarn.md`. It states that:
- the Spark Shuffle Service runs inside the `NodeManager` JVM, so all `NodeManager`s must run on a supported version of Java, and
- unlike Spark applications, the shuffle service cannot use a different JDK from the `NodeManager`.

The paragraph links the supported Java versions in `docs/index.md` instead of naming a Java version, so the same text stays correct when the minimum Java version changes.

### Why are the changes needed?

`spark-<version>-yarn-shuffle.jar` is built from `common/network-yarn`, which does not override `java.version`. So its classes target the minimum Java version of Apache Spark, which is Java 17 since Apache Spark 4.0.0. For example, `YarnShuffleService.class` has the class file major version 61 in the 4.0.4, 4.1.3, 4.2.0, and 4.3.0 binary distributions. A `NodeManager` on an older Java cannot load `org.apache.spark.network.yarn.YarnShuffleService`.

The guide explains how to use a different JDK for Spark applications when the YARN cluster runs an older Java (`Configuring different JDKs for Spark Applications`). That sets `JAVA_HOME` of the AM and the executors only, and does not help the shuffle service, which the `NodeManager` loads as an auxiliary service. However, the guide has never mentioned the Java requirement of the `NodeManager`s. For example, the [v4.0.0](https://github.com/apache/spark/releases/tag/v4.0.0) (2025-05-19) guide said `Apache Hadoop does not support Java 17 as of 3.4.1`, while its `Configuring the External Shuffle Service` section had no Java requirement.

This was raised in the review of #59897 (#59897 (comment)), which makes Java 21 the minimum in Apache Spark 5.0.0. The documentation gap is independent of #59897 because it exists since Apache Spark 4.0.0.

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

No. This is a documentation-only change.

### How was this patch tested?

Manual review.
- Both link targets already exist: the `Downloading` section of `index.md`, which lists the supported Java versions, and the `Configuring different JDKs for Spark Applications` section, which the same page already links at the top.
- The class file versions above were read from `yarn/spark-<version>-yarn-shuffle.jar` of the binary distributions.

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

Generated-by: Claude Opus 5.5

Closes #60052 from dongjoon-hyun/SPARK-60837.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 152e072)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Nov 3, 2026
… Java version for the Spark Shuffle Service

### What changes were proposed in this pull request?

This PR adds a paragraph to the `Configuring the External Shuffle Service` section of `docs/running-on-yarn.md`. It states that:
- the Spark Shuffle Service runs inside the `NodeManager` JVM, so all `NodeManager`s must run on a supported version of Java, and
- unlike Spark applications, the shuffle service cannot use a different JDK from the `NodeManager`.

The paragraph links the supported Java versions in `docs/index.md` instead of naming a Java version, so the same text stays correct when the minimum Java version changes.

### Why are the changes needed?

`spark-<version>-yarn-shuffle.jar` is built from `common/network-yarn`, which does not override `java.version`. So its classes target the minimum Java version of Apache Spark, which is Java 17 since Apache Spark 4.0.0. For example, `YarnShuffleService.class` has the class file major version 61 in the 4.0.4, 4.1.3, 4.2.0, and 4.3.0 binary distributions. A `NodeManager` on an older Java cannot load `org.apache.spark.network.yarn.YarnShuffleService`.

The guide explains how to use a different JDK for Spark applications when the YARN cluster runs an older Java (`Configuring different JDKs for Spark Applications`). That sets `JAVA_HOME` of the AM and the executors only, and does not help the shuffle service, which the `NodeManager` loads as an auxiliary service. However, the guide has never mentioned the Java requirement of the `NodeManager`s. For example, the [v4.0.0](https://github.com/apache/spark/releases/tag/v4.0.0) (2025-05-19) guide said `Apache Hadoop does not support Java 17 as of 3.4.1`, while its `Configuring the External Shuffle Service` section had no Java requirement.

This was raised in the review of #59897 (#59897 (comment)), which makes Java 21 the minimum in Apache Spark 5.0.0. The documentation gap is independent of #59897 because it exists since Apache Spark 4.0.0.

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

No. This is a documentation-only change.

### How was this patch tested?

Manual review.
- Both link targets already exist: the `Downloading` section of `index.md`, which lists the supported Java versions, and the `Configuring different JDKs for Spark Applications` section, which the same page already links at the top.
- The class file versions above were read from `yarn/spark-<version>-yarn-shuffle.jar` of the binary distributions.

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

Generated-by: Claude Opus 5.5

Closes #60052 from dongjoon-hyun/SPARK-60837.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 152e072)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Nov 3, 2026
… Java version for the Spark Shuffle Service

### What changes were proposed in this pull request?

This PR adds a paragraph to the `Configuring the External Shuffle Service` section of `docs/running-on-yarn.md`. It states that:
- the Spark Shuffle Service runs inside the `NodeManager` JVM, so all `NodeManager`s must run on a supported version of Java, and
- unlike Spark applications, the shuffle service cannot use a different JDK from the `NodeManager`.

The paragraph links the supported Java versions in `docs/index.md` instead of naming a Java version, so the same text stays correct when the minimum Java version changes.

### Why are the changes needed?

`spark-<version>-yarn-shuffle.jar` is built from `common/network-yarn`, which does not override `java.version`. So its classes target the minimum Java version of Apache Spark, which is Java 17 since Apache Spark 4.0.0. For example, `YarnShuffleService.class` has the class file major version 61 in the 4.0.4, 4.1.3, 4.2.0, and 4.3.0 binary distributions. A `NodeManager` on an older Java cannot load `org.apache.spark.network.yarn.YarnShuffleService`.

The guide explains how to use a different JDK for Spark applications when the YARN cluster runs an older Java (`Configuring different JDKs for Spark Applications`). That sets `JAVA_HOME` of the AM and the executors only, and does not help the shuffle service, which the `NodeManager` loads as an auxiliary service. However, the guide has never mentioned the Java requirement of the `NodeManager`s. For example, the [v4.0.0](https://github.com/apache/spark/releases/tag/v4.0.0) (2025-05-19) guide said `Apache Hadoop does not support Java 17 as of 3.4.1`, while its `Configuring the External Shuffle Service` section had no Java requirement.

This was raised in the review of #59897 (#59897 (comment)), which makes Java 21 the minimum in Apache Spark 5.0.0. The documentation gap is independent of #59897 because it exists since Apache Spark 4.0.0.

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

No. This is a documentation-only change.

### How was this patch tested?

Manual review.
- Both link targets already exist: the `Downloading` section of `index.md`, which lists the supported Java versions, and the `Configuring different JDKs for Spark Applications` section, which the same page already links at the top.
- The class file versions above were read from `yarn/spark-<version>-yarn-shuffle.jar` of the binary distributions.

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

Generated-by: Claude Opus 5.5

Closes #60052 from dongjoon-hyun/SPARK-60837.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 152e072)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@dongjoon-hyun

dongjoon-hyun commented Nov 3, 2026 •

Copy link
Copy Markdown
Member Author

Thank you, @pan3793 , @sarutak , @viirya , @LuciferYang , @peter-toth , @zhengruifeng , @HyukjinKwon .

I'm going to merge this before being stale because this kind of PRs are fragile.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Merge Summary:

Posted by merge_spark_pr.py

@dongjoon-hyun
dongjoon-hyun deleted the SPARK-60669 branch November 3, 2026 16:26
dongjoon-hyun added a commit that referenced this pull request Nov 3, 2026
… `HiveExternalCatalogVersionsSuite`

### What changes were proposed in this pull request?

This PR aims to make `HiveExternalCatalogVersionsSuite` test the old Spark versions that support the running Java version, instead of skipping all of them on Java 21 and later.

| Java | Release lines to test | Old Spark versions to test today |
| :-: | :-: | :-: |
| 17 | 3.3 and later (no change) | 3.5.9, 4.0.5, 4.1.4, 4.2.1, 4.3.0 |
| 21 | 4.0 and later | 4.0.5, 4.1.4, 4.2.1, 4.3.0 |
| 25 | 4.2 and later | 4.2.1, 4.3.0 |
| Others, e.g., 26 | None (no change) | None |

Each minimum release line is the first release line whose documentation lists the Java version.
- Apache Spark 3.3 to 3.5: `Spark runs on Java 8/11/17`
- Apache Spark 4.0 and 4.1: `Spark runs on Java 17/21`
- Apache Spark 4.2 and 4.3: `Spark runs on Java 17/21/25`

No release line supports the other Java versions, e.g., Java 26. So, this suite keeps skipping the old Spark versions on them, and the log message shows the running Java version instead of `Java 21`.

In addition, this PR uses `Runtime.version().feature()` instead of `Utils.isJavaVersionAtMost17`.

### Why are the changes needed?

SPARK-44095 (Apache Spark 3.5.0) made this suite skip the old Spark versions on Java 21 because no Spark release supported Java 21 at that time. Now, Apache Spark 4.0.0 and later support Java 21, and Apache Spark 4.2.0 and later support Java 25. However, the Java 21 and Java 25 CIs still skip all old Spark versions.

Moreover, SPARK-60669 (#59897) is going to drop Java 17 support at Apache Spark 5.0.0. After that, no `master` CI runs this suite on Java 17, and `master` would lose this backward compatibility test completely.

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

No. This is a test-only change.

### How was this patch tested?

Pass the CIs. In addition, I ran this suite manually with Java 17, 21, 25, and 26.

**Java 21**
```
$ build/sbt -Phive 'hive/testOnly *HiveExternalCatalogVersionsSuite'
...
[info] HiveExternalCatalogVersionsSuite:
[info] - backward compatibility (16 seconds, 636 milliseconds)
[info] Run completed in 52 seconds, 578 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.

$ grep -E 'SparkContext: (Running Spark version|Java version)' sql/hive/target/unit-tests.log | sed 's/.*SparkContext: //'
Running Spark version 4.0.5
Java version 21.0.13
Running Spark version 4.1.4
Java version 21.0.13+9-LTS
Running Spark version 4.2.1
Java version 21.0.13+9-LTS
Running Spark version 4.3.0
Java version 21.0.13+9-LTS
```

**Summary**

| Java | Old Spark versions that ran `spark-submit` | `backward compatibility` |
| :-: | :-: | :-: |
| 17.0.21 | 3.5.9, 4.0.5, 4.1.4, 4.2.1, 4.3.0 | Passed (17 seconds) |
| 21.0.13 | 4.0.5, 4.1.4, 4.2.1, 4.3.0 | Passed (16 seconds) |
| 25.0.5 | 4.2.1, 4.3.0 | Passed (13 seconds) |
| 26.0.2 | None | Passed (11 milliseconds) |

On Java 26, this suite logs `Skip tests because old Spark versions don't support Java 26.` and runs no old Spark version.

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

Generated-by: Claude Opus 5.5

Closes #60049 from dongjoon-hyun/SPARK-60833.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Nov 3, 2026
… `HiveExternalCatalogVersionsSuite`

### What changes were proposed in this pull request?

This PR aims to make `HiveExternalCatalogVersionsSuite` test the old Spark versions that support the running Java version, instead of skipping all of them on Java 21 and later.

| Java | Release lines to test | Old Spark versions to test today |
| :-: | :-: | :-: |
| 17 | 3.3 and later (no change) | 3.5.9, 4.0.5, 4.1.4, 4.2.1, 4.3.0 |
| 21 | 4.0 and later | 4.0.5, 4.1.4, 4.2.1, 4.3.0 |
| 25 | 4.2 and later | 4.2.1, 4.3.0 |
| Others, e.g., 26 | None (no change) | None |

Each minimum release line is the first release line whose documentation lists the Java version.
- Apache Spark 3.3 to 3.5: `Spark runs on Java 8/11/17`
- Apache Spark 4.0 and 4.1: `Spark runs on Java 17/21`
- Apache Spark 4.2 and 4.3: `Spark runs on Java 17/21/25`

No release line supports the other Java versions, e.g., Java 26. So, this suite keeps skipping the old Spark versions on them, and the log message shows the running Java version instead of `Java 21`.

In addition, this PR uses `Runtime.version().feature()` instead of `Utils.isJavaVersionAtMost17`.

### Why are the changes needed?

SPARK-44095 (Apache Spark 3.5.0) made this suite skip the old Spark versions on Java 21 because no Spark release supported Java 21 at that time. Now, Apache Spark 4.0.0 and later support Java 21, and Apache Spark 4.2.0 and later support Java 25. However, the Java 21 and Java 25 CIs still skip all old Spark versions.

Moreover, SPARK-60669 (#59897) is going to drop Java 17 support at Apache Spark 5.0.0. After that, no `master` CI runs this suite on Java 17, and `master` would lose this backward compatibility test completely.

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

No. This is a test-only change.

### How was this patch tested?

Pass the CIs. In addition, I ran this suite manually with Java 17, 21, 25, and 26.

**Java 21**
```
$ build/sbt -Phive 'hive/testOnly *HiveExternalCatalogVersionsSuite'
...
[info] HiveExternalCatalogVersionsSuite:
[info] - backward compatibility (16 seconds, 636 milliseconds)
[info] Run completed in 52 seconds, 578 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.

$ grep -E 'SparkContext: (Running Spark version|Java version)' sql/hive/target/unit-tests.log | sed 's/.*SparkContext: //'
Running Spark version 4.0.5
Java version 21.0.13
Running Spark version 4.1.4
Java version 21.0.13+9-LTS
Running Spark version 4.2.1
Java version 21.0.13+9-LTS
Running Spark version 4.3.0
Java version 21.0.13+9-LTS
```

**Summary**

| Java | Old Spark versions that ran `spark-submit` | `backward compatibility` |
| :-: | :-: | :-: |
| 17.0.21 | 3.5.9, 4.0.5, 4.1.4, 4.2.1, 4.3.0 | Passed (17 seconds) |
| 21.0.13 | 4.0.5, 4.1.4, 4.2.1, 4.3.0 | Passed (16 seconds) |
| 25.0.5 | 4.2.1, 4.3.0 | Passed (13 seconds) |
| 26.0.2 | None | Passed (11 milliseconds) |

On Java 26, this suite logs `Skip tests because old Spark versions don't support Java 26.` and runs no old Spark version.

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

Generated-by: Claude Opus 5.5

Closes #60049 from dongjoon-hyun/SPARK-60833.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 59bdfec)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Nov 3, 2026
### What changes were proposed in this pull request?

This PR aims to upgrade `Apache Derby` from `10.16.1.1` to `10.17.1.0` for Apache Spark 5.0.0.

- https://db.apache.org/derby/releases/release-10_17_1_0.cgi (2023-11-10)

### Why are the changes needed?

Since Apache Spark 5.0.0 requires Java 21 or later (SPARK-60669), we can use `Derby 10.17.x`, which supports only Java 21 and later. Previously, we stayed on `Derby 10.16.1.1` because `10.17.1.0` requires Java 21+.

- #59897

`Derby 10.17.1.0` brings the following fixes.

- [DERBY-7143](https://issues.apache.org/jira/browse/DERBY-7143) HarmonySerialBlob.getBinaryStream(long, long) makes it impossible to retrieve the last character of the Blob
- [DERBY-7144](https://issues.apache.org/jira/browse/DERBY-7144) MERGE INSERT failing when target has GENERATED IDENTITY column
- [DERBY-7147](https://issues.apache.org/jira/browse/DERBY-7147) LDAP injection vulnerability in LDAPAuthenticationImpl (CVE-2022-46337)
- [DERBY-7149](https://issues.apache.org/jira/browse/DERBY-7149) Make it possible to build and test Derby cleanly with JDK 20

In addition, `10.17.1.0` is the final release of Apache Derby because the Derby developers voted to retire the project on 2025-10-10.

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

No behavior change is expected. Only the bundled Derby jars (`derby`, `derbyshared`, `derbytools`) are upgraded.

### How was this patch tested?

Pass the CIs.

In addition, I manually ran the test suites that use Derby on Java 21.

```
$ build/sbt -Phive -Phive-thriftserver \
  "core/testOnly *JdbcRDDSuite" \
  "sql/testOnly *DerbyTableCatalogSuite *JDBCSuite" \
  "hive/testOnly *HiveSharedStateSuite *HiveExternalCatalogSuite" \
  "hive-thriftserver/testOnly *SparkSQLEnvSuite *CliSuite"
```

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

Generated-by: Claude Opus 5.5

Closes #60065 from dongjoon-hyun/dongjoon/derby-upgrade-9b7bf2.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Nov 5, 2026
…olden files

### What changes were proposed in this pull request?

This PR aims to use the Java 21 results as the default SQL golden files because Apache Spark 5.0.0 requires Java 21 or later since SPARK-60669 (#59897).

- Promote the following 7 `*.sql.out.java21` files to the default `*.sql.out` files and remove the `.java21` files.
  - `datetime-formatting.sql.out`
  - `nonansi/try_aggregates.sql.out`
  - `nonansi/try_arithmetic.sql.out`
  - `postgreSQL/float4.sql.out`
  - `postgreSQL/int8.sql.out`
  - `postgreSQL/numeric.sql.out`
  - `try_aggregates.sql.out`
- Remove the Java version-based golden file selection of `SQLQueryTestSuite` and `ThriftServerQueryTestSuite`, which SPARK-40732 (#41658) added, and the `.*out.java21` pattern of `dev/.rat-excludes`.
- Update the meaning of the datetime pattern letter `F` in `sql-ref-datetime-pattern.md` to `aligned-week-of-month`, as the Java 21 `DateTimeFormatter` documentation describes it.
- Add a migration guide item for the users who ran Spark 4.x on Java 17.

### Why are the changes needed?

The `.java21` files and the selection logic were needed only while Spark supported both Java 17 and Java 21. The differences come from the following Java changes.
- [JDK-8282081](https://bugs.openjdk.org/browse/JDK-8282081): `DateTimeFormatter` maps the pattern letter `F` to `ALIGNED_WEEK_OF_MONTH` instead of `ALIGNED_DAY_OF_WEEK_IN_MONTH`.
- [JDK-4511638](https://bugs.openjdk.org/browse/JDK-4511638): `Float.toString` and `Double.toString` return the shortest decimal that represents the value.

Since Java 17 cannot build the `master` branch anymore, nobody can regenerate the default files of these inputs. On Java 21, `SPARK_GENERATE_GOLDEN_FILES=1` updates only the `.java21` files, so the default files become stale whenever these inputs change. In addition, the documentation of `F` describes the Java 17 behavior.

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

No. Apache Spark 5.0.0 already requires Java 21, and this PR changes only test files and documentation. The new migration guide item documents the following differences, which are the results of the Apache Spark 4.3.0 binary distribution on Java 17 and Java 21.

| Query | Java 17 | Java 21 |
| - | - | - |
| `SELECT date_format(date '2019-12-31', 'F')` | `3` | `5` |
| `SELECT CAST(CAST(4567890123456789 AS FLOAT) AS STRING)` | `4.5678899E15` | `4.56789E15` |
| `SELECT CAST(1.0751133388005187E17D AS DECIMAL(38, 0))` | `107511333880051872` | `107511333880051870` |

### How was this patch tested?

Pass the CIs.

I also regenerated the golden files of the 7 inputs with Java 21 after removing the selection logic, and confirmed that they are identical to the removed `.java21` files and that no other golden file changed.

```
$ SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z datetime-formatting.sql -z try_aggregates.sql -z nonansi/try_arithmetic.sql -z postgreSQL/float4.sql -z postgreSQL/int8.sql -z postgreSQL/numeric.sql"
```

Then, the following passed with Java 21. `ThriftServerQueryTestSuite` ignores `postgreSQL/float4.sql` as before.

```
$ build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z datetime-formatting.sql -z try_aggregates.sql -z nonansi/try_arithmetic.sql -z postgreSQL/float4.sql -z postgreSQL/int8.sql -z postgreSQL/numeric.sql"
...
[info] Tests: succeeded 14, failed 0, canceled 0, ignored 0, pending 0

$ build/sbt -Phive -Phive-thriftserver "hive-thriftserver/testOnly org.apache.spark.sql.hive.thriftserver.ThriftServerQueryTestSuite -- -z datetime-formatting.sql -z try_aggregates.sql -z nonansi/try_arithmetic.sql -z postgreSQL/float4.sql -z postgreSQL/int8.sql -z postgreSQL/numeric.sql"
...
[info] Tests: succeeded 6, failed 0, canceled 0, ignored 1, pending 0
```

The same `SQLQueryTestSuite` command also passed with Java 25.

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

Generated-by: Claude Opus 5.5

Closes #60109 from dongjoon-hyun/SPARK-60894.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants