Skip to content

[Feature Request]: Support Apache Spark 4.x in Beam Spark Runner #36841

Open

Description

@future-h-takeda-g3

What would you like to happen?

I would like Beam's Spark Runner to officially support Apache Spark 4.0. Spark 4.0 brings multiple improvements and new features, including performance enhancements, security updates, and updated APIs (e.g., improvements in shuffle, catalog features, Kubernetes operator, and structured streaming). As major platforms (such as Dataproc, EMR, and internal platforms) start adopting Spark 4.0, supporting this version will enable users to migrate without friction and leverage new Spark functionalities. Current Beam documentation lists support up to Spark 3.x, and 4.0 support is not mentioned. Attempting to run the Spark Runner on Spark 4.0 results in compatibility issues (such as dependency conflicts and API changes). Official CI matrix coverage, documentation, and dependency updates for 4.0 are needed for safe production use. This would help unblock organizations intending to move to Spark 4.0 and keep Beam competitive as Spark evolves.

Issue Priority

Priority: 2 (default / most feature requests should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner

Activity

  1. liferoad commented on Nov 24, 2025

    @liferoad
    Contributor

    Spark 4.0 requires Java 17+.

  2. added a commit that references this issue on Nov 24, 2025
    3e0b841
  3. Abacn commented on Dec 1, 2025

    @Abacn
    Contributor

    Spark 4.0 requires Java 17+.

    We can set applyJavaNature(..., requireJavaVersion: JavaVersion.VERSION_17) for BeamModulePlugin.

  4. added this to the Beam 3.0.0 - Milestone 3 milestone on Dec 1, 2025
  5. nia-potato commented on Mar 4, 2026

    @nia-potato

    hi, any updates on this? we are currently blocked by this issue. thanks

  6. tkaymak commented on Apr 14, 2026

    @tkaymak
    Contributor

    @Abacn is this issue still valid to be targeted for the 3.0 release? Can I help here?

  7. 12 remaining items

  8. added a commit that references this issue on Sep 11, 2026
  9. tkaymak commented on Sep 11, 2026

    @tkaymak
    Contributor

    Slice 4, the stateless streaming translator, merged as #40090. The Spark 4 runner now runs unbounded reads, stateless ParDo, Window.Assign, Flatten and Reshuffle in streaming mode, everything else fails at translation with a message pointing here.

    Found on the way: cancel() did not cancel Spark jobs and could stop a shared SparkSession, #40101, fix in #40103.

    Remaining, cut from #39576 in this order: state and timer internals, the transformWithState processor, the GroupByKey and stateful ParDo translators, then PAssert support. No CHANGES.md entry until windowed GroupByKey lands.

  10. Abacn commented on Sep 14, 2026

    @Abacn
    Contributor

    My personal suggest is to setup ValidateRunner test suite as long as there is meaningful tests can pass. Then the addition is verified to functioning in pipeline level when checking in

  11. tkaymak commented on Sep 15, 2026

    @tkaymak
    Contributor

    Thanks for the suggestion, I looked into wiring ValidatesRunner for streaming:

    • All existing ValidatesRunner tests in sdks/java/core use Create.of or PAssert, which require GroupByKey (Slice 5c) and Impulse (Slice 5d), so zero SDK ValidatesRunner tests can pass on master yet.

    My plan is to introduce validatesStructuredStreamingRunnerStreaming alongside Slice 5c and 5d, so standard SDK tests start validating the runner end to end as soon as GroupByKey and PAssert land.

  12. added 2 commits that reference this issue on Sep 15, 2026
  13. added a commit that references this issue on Sep 15, 2026
  14. added a commit that references this issue on Sep 15, 2026
  15. added a commit that references this issue on Sep 19, 2026
  16. added a commit that references this issue on Sep 22, 2026
  17. tkaymak commented on Sep 25, 2026

    @tkaymak
    Contributor

    Status update on slice 5b. Stateful ParDo, meaning state plus event time timers, now runs on the Spark 4 Structured Streaming runner through transformWithState. It is coded and tested locally. The PR is not opened yet.

    There is one known blocker for 5c. Spark has no watermark hold. So output from an event time timer is emitted after the watermark has already passed the timer timestamp. That is harmless when only stateless ParDos follow. A downstream GroupByKey would drop that output as late. Before 5c supports a GroupByKey after a stateful ParDo, it needs a way to hold back output timestamps, or it has to reject that pipeline shape.

  18. tkaymak commented on Oct 12, 2026

    @tkaymak
    Contributor

    Status update. Slice 5b, stateful ParDo via transformWithState, merged in #40281. The blocker from my last comment is resolved by #40447: late data is now filtered against the key's previous watermark, so timer output behind the shared watermark survives into a downstream stateful operator. The bound is per key rather than per batch, tracked in #40446. Next is windowed GroupByKey and Combine on the same processor, then Impulse and PAssert so a streaming ValidatesRunner suite can run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions