Skip to content

Conversation

@liferoad
Copy link
Contributor

This commit resolves all 31 compilation errors in the :runners:spark:4 module, enabling successful compilation with Spark 4.0.0-preview2, Scala 2.13, and Java 17.

Key changes:

  1. Scala 2.13 API Compatibility:

    • Replaced TraversableOnce with IterableOnce
    • Changed scala.Serializable to java.io.Serializable
    • Fixed union() method ambiguity by explicitly specifying type parameters
    • Modified ScalaInterop.seqOf() to return scala.collection.immutable.Seq
  2. ExpressionEncoder Constructor Migration:

    • Implemented reflection-based approach in EncoderFactory to handle Spark 4.x API changes
    • Attempts to use ExpressionEncoder.apply with FlatEncoder wrappers
    • Added @SuppressWarnings("nullness") for Checker Framework compatibility
  3. updateStateByKey Signature Adaptation:

    • Created Function2 adapter in SparkGroupAlsoByWindowViaWindowSet
    • Wrapped iterator-based UpdateStateByKeyFunction to match Spark 4.x signature
    • Changed from Seq to scala.collection.immutable.Seq
  4. Nullness Annotations:

Fixes #36841

Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

This commit resolves all 31 compilation errors in the :runners:spark:4 module,
enabling successful compilation with Spark 4.0.0-preview2, Scala 2.13, and Java 17.

Key changes:

1. Scala 2.13 API Compatibility:
   - Replaced TraversableOnce with IterableOnce
   - Changed scala.Serializable to java.io.Serializable
   - Fixed union() method ambiguity by explicitly specifying type parameters
   - Modified ScalaInterop.seqOf() to return scala.collection.immutable.Seq

2. ExpressionEncoder Constructor Migration:
   - Implemented reflection-based approach in EncoderFactory to handle Spark 4.x API changes
   - Attempts to use ExpressionEncoder.apply with FlatEncoder wrappers
   - Added @SuppressWarnings("nullness") for Checker Framework compatibility

3. updateStateByKey Signature Adaptation:
   - Created Function2 adapter in SparkGroupAlsoByWindowViaWindowSet
   - Wrapped iterator-based UpdateStateByKeyFunction to match Spark 4.x signature
   - Changed from Seq to scala.collection.immutable.Seq

4. Nullness Annotations:
   - Added @SuppressWarnings("nullness") in EvaluationContext for Checker Framework

Fixes apache#36841
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.

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

1 participant