Add Spark 4.0 support via deequ:2.0.14-spark-4.0#259
Open
m-aciek wants to merge 5 commits intoawslabs:masterfrom
Open
Add Spark 4.0 support via deequ:2.0.14-spark-4.0#259m-aciek wants to merge 5 commits intoawslabs:masterfrom
m-aciek wants to merge 5 commits intoawslabs:masterfrom
Conversation
- Add "4.0" entry to SPARK_TO_DEEQU_COORD_MAPPING in configs.py - Widen pyspark optional dep bound to <5.0.0 in pyproject.toml - Replace scala.collection.JavaConversions (removed in Scala 2.13) with JavaConverters in scala_utils.py and profiles.py - Replace scala.collection.Seq.empty() (inaccessible via Py4J in Scala 2.13) with to_scala_seq(jvm, jvm.java.util.ArrayList()) in analyzers.py and checks.py - Add Spark 4.0.0 to CI matrix with Java 17; use include: style to pair each Spark version with its required Java version Fixes awslabs#258
PySpark 4.0 requires Python >=3.9. Update the CI matrix to carry a PYTHON_VERSION per entry (3.8 for Spark 3.x, 3.9 for Spark 4.x) and use it in the setup-python step. Split the pyspark optional dep in pyproject.toml into two version-marker entries so poetry can resolve correctly on both Python 3.8 (pyspark <4.0) and Python 3.9+ (pyspark <5.0).
The previous fix passed Stream$Empty$ to deequ constructors/methods via to_scala_seq(jvm, ArrayList()), which Py4J's reflection-based overload resolution rejects in Scala 2.12 (Spark 3.x). Add empty_scala_seq() helper that uses JavaConverters.toList() instead of toSeq(). This produces immutable.Nil (an empty List), which deequ accepts as Seq[_] in both Scala 2.12 and 2.13, and is correctly matched by Py4J constructor/method lookup in both versions.
Affirm-Skill: acli-jira Affirm-Skill: att-deploy-check Affirm-Skill: att-test Affirm-Skill: buildkite-debug Affirm-Skill: capture-context Affirm-Skill: cmt-writer Affirm-Skill: commit-and-push Affirm-Skill: create-adr Affirm-Skill: create-cmt-ticket Affirm-Skill: create-tech-spec Affirm-Skill: export-conversation-record Affirm-Skill: gather-best-practices Affirm-Skill: mcp-debug Affirm-Skill: multi-thor-provisioner Affirm-Skill: resolve-pr-comments Affirm-Skill: save-output Affirm-Skill: security-scanner-for-skill-md Affirm-Skill: skill-evaluator Affirm-Skill: thor-control Affirm-Skill: tickets-from-plan Affirm-Skill: write-implementation-plan
Affirm-Skill: acli-jira Affirm-Skill: att-deploy-check Affirm-Skill: att-test Affirm-Skill: buildkite-debug Affirm-Skill: capture-context Affirm-Skill: cmt-writer Affirm-Skill: commit-and-push Affirm-Skill: create-adr Affirm-Skill: create-cmt-ticket Affirm-Skill: create-tech-spec Affirm-Skill: export-conversation-record Affirm-Skill: gather-best-practices Affirm-Skill: mcp-debug Affirm-Skill: multi-thor-provisioner Affirm-Skill: resolve-pr-comments Affirm-Skill: save-output Affirm-Skill: security-scanner-for-skill-md Affirm-Skill: skill-evaluator Affirm-Skill: thor-control Affirm-Skill: tickets-from-plan Affirm-Skill: write-implementation-plan
Author
|
This is now ready for review; CI tests pass on my fork: https://github.com/m-aciek/python-deequ/actions/runs/24196839467 |
chenliu0831
approved these changes
Apr 15, 2026
Contributor
chenliu0831
left a comment
There was a problem hiding this comment.
LGTM. I'm not sure if we would like to keep maintaining the Py4j approach though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #258
Summary
"4.0": "com.amazon.deequ:deequ:2.0.14-spark-4.0"toSPARK_TO_DEEQU_COORD_MAPPINGinconfigs.py>=2.4.7,<3.4.0to>=2.4.7,<5.0.0inpyproject.tomlscala.collection.JavaConversions(removed in Scala 2.13) withJavaConvertersinscala_utils.pyandprofiles.pyscala.collection.Seq.empty()(inaccessible via Py4J in Scala 2.13) with an empty Java list converted viato_scala_seqinanalyzers.pyandchecks.pyinclude:style so each Spark version carries its required Java versionRoot causes fixed
Spark 4 uses Scala 2.13, which introduced two breaking changes affecting pydeequ:
scala.collection.JavaConversionswas removed — replaced byJavaConverterswith explicit.asScala()/.asJava()callsscala.collection.Seq.empty()is not accessible via Py4J reflection — replaced withto_scala_seq(jvm, jvm.java.util.ArrayList())which constructs an empty ScalaSeqvia the already-fixed converterTest plan
SPARK_VERSION=4.0.0/pyspark==4.0.0PR authored with assistance from Claude Code