Skip to content

[AURON #2017] [BUILD] Add Spark 4.x support to dev/reformat script.#2018

Open
slfan1989 wants to merge 3 commits intoapache:masterfrom
slfan1989:auron-2017
Open

[AURON #2017] [BUILD] Add Spark 4.x support to dev/reformat script.#2018
slfan1989 wants to merge 3 commits intoapache:masterfrom
slfan1989:auron-2017

Conversation

@slfan1989
Copy link
Contributor

Which issue does this PR close?

Closes #2017

Rationale for this change

With Spark 4.0 and 4.1 support added to the project, the dev/reformat script needs to be updated to handle formatting and style checks for these new versions. Spark 4.x requires JDK 17+ and Scala 2.13, while Spark 3.x uses JDK 8 and Scala 2.12. The script should automatically switch between these environments.

What changes are included in this PR?

1. Fix Flink Maven profile

  • Before: -Pflink,flink-1.18
  • After: -Pflink-1.18
  • Reason: Avoid activating non-existent flink profile

2.Add Spark 4.x support

  • Add spark-4.0 and spark-4.1 to the version sweep list
  • Auto-switch to scala-2.13 profile for Spark 4.x (Spark 4.x requires Scala 2.13)
  • Auto-switch to JDK 17 for Spark 4.x (Spark 4.x requires JDK 17+)
  • Auto-switch back to JDK 8 for Spark 3.x versions

3.Update CI workflow (.github/workflows/style.yml)

  • Add JDK 17 setup alongside existing JDK 8
  • Enable style check to work with both Spark 3.x and Spark 4.x versions

Are there any user-facing changes?

No.

How was this patch tested?

Verified automatic JDK switching works for Spark 3.x (JDK 8) and Spark 4.x (JDK 17)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for Spark 4.0 and 4.1 to the dev/reformat script, enabling automated code formatting and style checks for the new Spark versions. The script is updated to automatically switch between JDK and Scala versions based on the Spark version being processed, as Spark 4.x requires JDK 17+ and Scala 2.13, while Spark 3.x uses JDK 8 and Scala 2.12.

Changes:

  • Fixed Maven profile references for Flink and Iceberg to use correct versioned profile IDs
  • Added Spark 4.0 and 4.1 to the version sweep array in the reformat script
  • Implemented automatic JDK and Scala version switching logic for Spark 4.x vs 3.x
  • Updated CI workflow to set up both JDK 8 and JDK 17
  • Applied formatting changes to Scala files (indentation adjustments from running the reformatter)

Reviewed changes

Copilot reviewed 3 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
dev/reformat Core changes: fixed Flink/Iceberg profiles, added Spark 4.0/4.1 to version array, added JDK/Scala switching logic
.github/workflows/style.yml Added JDK 17 setup to support Spark 4.x formatting in CI
thirdparty/auron-uniffle/src/main/scala/org/apache/spark/sql/execution/auron/shuffle/uniffle/AuronUniffleShuffleReader.scala Indentation formatting adjustment
spark-extension/src/main/scala/org/apache/spark/sql/execution/auron/plan/NativeParquetInsertIntoHiveTableBase.scala Indentation formatting adjustment
spark-extension/src/main/scala/org/apache/spark/sql/auron/util/TaskContextHelper.scala Indentation formatting adjustment
spark-extension/src/main/scala/org/apache/spark/sql/auron/NativeHelper.scala Indentation formatting adjustment
spark-extension/src/main/scala/org/apache/spark/sql/auron/AuronSparkSessionExtension.scala Indentation formatting adjustment
spark-extension/src/main/scala/org/apache/spark/sql/auron/AuronConverters.scala Indentation formatting adjustments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@slfan1989
Copy link
Contributor Author

@cxzl25 Thanks for reviewing this pr! I’ll continue refining this pr.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <[email protected]>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +93 to 103
# Run spotless with a consistent JDK/version to avoid formatting drift.
run_spotless scala-2.12 spark-3.5
run_spotless scala-2.13 spark-4.0

# Check or format all code, including third-party code, with spark-3.5
set_java_home 8
sparkver=spark-3.5
for celebornver in celeborn-0.5 celeborn-0.6
do
run_maven -P"${sparkver}" -Pceleborn,"${celebornver}" -Puniffle,uniffle-0.10 -Ppaimon,paimon-1.2 -Pflink,flink-1.18 -Piceberg,iceberg-1.9
run_maven -P"${sparkver}" -Pceleborn,"${celebornver}" -Puniffle,uniffle-0.10 -Ppaimon,paimon-1.2 -Pflink-1.18 -Piceberg-1.9

Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

run_spotless only runs for scala-2.12/spark-3.5 and scala-2.13/spark-4.0 and does not activate the third-party module profiles (celeborn/uniffle/paimon/flink/iceberg). Since Spotless was removed from run_maven, formatting problems inside those third-party modules are no longer enforced by ./dev/reformat --check (and may be silently auto-applied during compile due to the lifecycle-bound Spotless execution). Consider running run_spotless with the same third-party profiles used later in the script, or reintroducing spotless:check for those third-party runs.

Copilot uses AI. Check for mistakes.
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.

[BUILD] Add Spark 4.x support to dev/reformat script

2 participants