You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "tkaymak (via GitHub)" <gi...@apache.org> on 2026/04/29 16:18:17 UTC
[PR] [Spark Runner] Prep shared base for Spark 4 (deprecated→removed call replacements + BeamModulePlugin + requireJavaVersion routing) [beam]
tkaymak opened a new pull request, #38324:
URL: https://github.com/apache/beam/pull/38324
First split-out PR from #38255 per @Abacn's review guidance
(https://github.com/apache/beam/pull/38255#pullrequestreview-4190129854):
> Yeah, I don't expect we can get everything working with oneshot. We can do
> the following
> - all common file changes (e.g. replace calls already deprecated in Spark 3
> then removed in Spark 4), BeamModulePlugin, requireJavaVersion logics
> goes first
Three commits, one per bucket:
1. **Replace Scala/shaded-Guava calls deprecated in Spark 3, removed in Spark 4.**
8 shared-base files. JavaConversions → JavaConverters; scala.Serializable →
java.io.Serializable; StreamingContext.union(...).toList() to satisfy the
immutable.Seq overload; sparkproject.guava → vendor.guava equivalents.
2. **Add Spark 4 hooks to BeamModulePlugin** — spark4_version constant +
project.ext export + jackson_module_scala_2_13 library entry. The first
two are inert until #38255 lands; the Jackson entry is independently useful.
3. **Numeric isSparkAtLeast helper + requireJavaVersion routing** in
spark_runner.gradle and spark_job_server.gradle. Standalone bug fix
(lex compare breaks for Spark 3.10+) plus future-proofs Java 17
enforcement for Spark 4 builds.
All hunks behaviour-identical on Spark 3.5; no new tests required.
CHANGES.md entry added under "New Features / Improvements".
Follow-up: rebase #38255 on master once this lands; the Spark 4 module add
will be much smaller and easier to review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runners-spark] Prep shared base for Spark 4 [beam]
Posted by "tkaymak (via GitHub)" <gi...@apache.org>.
tkaymak commented on code in PR #38324:
URL: https://github.com/apache/beam/pull/38324#discussion_r3163777350
##########
CHANGES.md:
##########
@@ -76,6 +76,12 @@
([#38139](https://github.com/apache/beam/issues/38139)).
* (Python) Added type alias for with_exception_handling to be used for typehints. ([#38173](https://github.com/apache/beam/issues/38173)).
* Added plugin mechanism to support different Lineage implementations (Java) ([#36790](https://github.com/apache/beam/issues/36790)).
+* Prepared the shared Spark runner base for Spark 4 compatibility: migrated
Review Comment:
Cleared in 075b3a4.
##########
CHANGES.md:
##########
@@ -76,6 +76,12 @@
([#38139](https://github.com/apache/beam/issues/38139)).
* (Python) Added type alias for with_exception_handling to be used for typehints. ([#38173](https://github.com/apache/beam/issues/38173)).
* Added plugin mechanism to support different Lineage implementations (Java) ([#36790](https://github.com/apache/beam/issues/36790)).
+* Prepared the shared Spark runner base for Spark 4 compatibility: migrated
Review Comment:
Thank you, makes sense!
Cleared in 075b3a4.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runners-spark] Prep shared base for Spark 4 [beam]
Posted by "tkaymak (via GitHub)" <gi...@apache.org>.
tkaymak commented on code in PR #38324:
URL: https://github.com/apache/beam/pull/38324#discussion_r3162565735
##########
runners/spark/job-server/spark_job_server.gradle:
##########
@@ -28,7 +28,10 @@ apply plugin: 'application'
// we need to set mainClassName before applying shadow plugin
mainClassName = "org.apache.beam.runners.spark.SparkJobServerDriver"
+def parentSparkVersion = project.parent.findProperty('spark_version') ?: ''
+
applyJavaNature(
+ requireJavaVersion: (parentSparkVersion.startsWith("4") ? org.gradle.api.JavaVersion.VERSION_17 : null),
Review Comment:
Addressed in `41f9df0f`.
##########
runners/spark/spark_runner.gradle:
##########
@@ -21,6 +21,7 @@ import groovy.json.JsonOutput
apply plugin: 'org.apache.beam.module'
applyJavaNature(
enableStrictDependencies: true,
+ requireJavaVersion: (spark_version.startsWith("4") ? org.gradle.api.JavaVersion.VERSION_17 : null),
Review Comment:
Addressed in `41f9df0f`.
##########
runners/spark/spark_runner.gradle:
##########
@@ -35,6 +36,16 @@ applyJavaNature(
description = "Apache Beam :: Runners :: Spark $spark_version"
+// Numeric version comparison (lexicographic string compare was fragile — e.g. "3.10.0" < "3.5.0").
+def isSparkAtLeast = { String minVersion ->
+ def parts = spark_version.tokenize('.-').findAll { it.isInteger() }*.toInteger()
+ def minParts = minVersion.tokenize('.')*.toInteger()
Review Comment:
Addressed in `41f9df0f`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Spark Runner] Prep shared base for Spark 4 (deprecated→removed call replacements + BeamModulePlugin + requireJavaVersion routing) [beam]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #38324:
URL: https://github.com/apache/beam/pull/38324#issuecomment-4345528953
## Summary of Changes
Hello, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request prepares the shared Spark runner base for upcoming Spark 4 compatibility. It focuses on refactoring code to be cross-compatible between Spark 3 and Spark 4, improving build infrastructure for version management, and ensuring correct Java version enforcement for future builds. These changes are behavior-identical on Spark 3.5 and serve as a foundational step for further Spark 4 integration.
### Highlights
* **Spark 4 Compatibility**: Migrated deprecated Scala collection and shaded-Guava calls to versions compatible with both Spark 3 and Spark 4.
* **Gradle Infrastructure**: Introduced a numeric `isSparkAtLeast` helper to replace fragile lexicographic version comparisons and updated `BeamModulePlugin` to include Spark 4 hooks.
* **Java Version Enforcement**: Routed `requireJavaVersion` through `applyJavaNature` to ensure future Spark 4 builds enforce Java 17.
🧠 **New Feature in Public Preview:** You can now enable **Memory** to help **Gemini Code Assist** learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. **Click [here](https://codeassist.google/code-review/login) to enable Memory in your admin console.**
<details>
<summary><b>Using Gemini Code Assist</b></summary>
<br>
The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.
<b>Invoking Gemini</b>
You can request assistance from Gemini at any point by creating a comment using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands on the current page.
Feature | Command | Description
--- | --- | ---
Code Review | `/gemini review` | Performs a code review for the current pull request in its current state.
Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state.
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help | `/gemini help` | Displays a list of available commands.
<b>Customization</b>
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
<b>Limitations & Feedback</b>
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up [here](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
</details>
[^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runners-spark] Prep shared base for Spark 4 [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #38324:
URL: https://github.com/apache/beam/pull/38324#issuecomment-4351611305
Assigning reviewers:
R: @Abacn for label build.
Note: If you would like to opt out of this review, comment `assign to next reviewer`.
Available commands:
- `stop reviewer notifications` - opt out of the automated review tooling
- `remind me after tests pass` - tag the comment author after tests pass
- `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runners-spark] Prep shared base for Spark 4 [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #38324:
URL: https://github.com/apache/beam/pull/38324#discussion_r3162944584
##########
CHANGES.md:
##########
@@ -76,6 +76,12 @@
([#38139](https://github.com/apache/beam/issues/38139)).
* (Python) Added type alias for with_exception_handling to be used for typehints. ([#38173](https://github.com/apache/beam/issues/38173)).
* Added plugin mechanism to support different Lineage implementations (Java) ([#36790](https://github.com/apache/beam/issues/36790)).
+* Prepared the shared Spark runner base for Spark 4 compatibility: migrated
Review Comment:
We don't need to add the item at this point. When the work is done we can add Spark 4 support to the "Highlights" section, like what we did for Flink 2 support announcement in Beam 2.72
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runners-spark] Prep shared base for Spark 4 [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #38324:
URL: https://github.com/apache/beam/pull/38324#issuecomment-4349010282
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runners-spark] Prep shared base for Spark 4 [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn merged PR #38324:
URL: https://github.com/apache/beam/pull/38324
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [runners-spark] Prep shared base for Spark 4 [beam]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #38324:
URL: https://github.com/apache/beam/pull/38324#discussion_r3162541050
##########
runners/spark/job-server/spark_job_server.gradle:
##########
@@ -28,7 +28,10 @@ apply plugin: 'application'
// we need to set mainClassName before applying shadow plugin
mainClassName = "org.apache.beam.runners.spark.SparkJobServerDriver"
+def parentSparkVersion = project.parent.findProperty('spark_version') ?: ''
+
applyJavaNature(
+ requireJavaVersion: (parentSparkVersion.startsWith("4") ? org.gradle.api.JavaVersion.VERSION_17 : null),
Review Comment:

Using `project.parent.findProperty` is fragile as it will throw a `NullPointerException` if the project has no parent (e.g., if it's the root project). It is more idiomatic and safer to use `project.findProperty('spark_version')`, which searches the project and all its ancestors. Additionally, using the variable name `sparkVersion` is more standard as properties are inherited across the project hierarchy.
```
def sparkVersion = project.findProperty('spark_version') ?: ''
applyJavaNature(
requireJavaVersion: (sparkVersion.startsWith("4") ? org.gradle.api.JavaVersion.VERSION_17 : null),
```
##########
runners/spark/spark_runner.gradle:
##########
@@ -21,6 +21,7 @@ import groovy.json.JsonOutput
apply plugin: 'org.apache.beam.module'
applyJavaNature(
enableStrictDependencies: true,
+ requireJavaVersion: (spark_version.startsWith("4") ? org.gradle.api.JavaVersion.VERSION_17 : null),
Review Comment:

This check uses `startsWith("4")`, which is less robust than the `isSparkAtLeast` helper introduced later in this file. To improve consistency and robustness, consider moving the `isSparkAtLeast` definition to the top of the script and using it here (e.g., `isSparkAtLeast("4.0.0")`).
##########
runners/spark/spark_runner.gradle:
##########
@@ -35,6 +36,16 @@ applyJavaNature(
description = "Apache Beam :: Runners :: Spark $spark_version"
+// Numeric version comparison (lexicographic string compare was fragile — e.g. "3.10.0" < "3.5.0").
+def isSparkAtLeast = { String minVersion ->
+ def parts = spark_version.tokenize('.-').findAll { it.isInteger() }*.toInteger()
+ def minParts = minVersion.tokenize('.')*.toInteger()
Review Comment:

The parsing of `minVersion` should be as robust as the parsing of `spark_version` at line 41. Using `tokenize('.-').findAll { it.isInteger() }` ensures that any non-numeric parts in the version string (e.g., if a developer passes a version with a suffix like `-preview`) do not cause a `NumberFormatException` during the `toInteger()` conversion.
```
def minParts = minVersion.tokenize('.-').findAll { it.isInteger() }*.toInteger()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org