Skip to content

build: enable Spark SQL tests for released Spark 4.2.0#4950

Open
andygrove wants to merge 10 commits into
apache:mainfrom
andygrove:spark-4.2.0
Open

build: enable Spark SQL tests for released Spark 4.2.0#4950
andygrove wants to merge 10 commits into
apache:mainfrom
andygrove:spark-4.2.0

Conversation

@andygrove

Copy link
Copy Markdown
Member

Which issue does this PR close?

Part of #4142.

Supersedes #4208, which was opened against 4.2.0-preview4 and went stale.

Rationale for this change

Spark 4.2.0 is now available in Maven Central, so the spark-4.2 profile no longer has to target a preview. This is stage 3 of the bring-up described in adding_a_new_spark_version.md: turn on Spark's own SQL tests for 4.2 and move the profile onto the released version.

Spark 4.2.0 is not simply 4.2.0-preview4 with the qualifier dropped. It restructures the test harness, changes SpecializedGetters, and repackages a dependency, so several real reconciliations were needed.

What changes are included in this PR?

Build

  • spark.version moves from 4.2.0-preview4 to 4.2.0.
  • Spark 4.2.0 bundles its own copy of org.apache.datasketches.memory.internal.ResourceImpl inside spark-catalyst, colliding with the transitive datasketches-memory jar and failing the BanDuplicateClasses enforcer rule. That class is now ignored.
  • The test-scope Jetty pin stays at 11.0.26. Spark 4.2.0 ships Jetty 12, but the Iceberg REST catalog test helper needs jetty-servlet, which Jetty 12 replaced with jetty-ee10-servlet. The stale comment claiming the pin matched preview4's Jetty version is corrected.

Shims

  • Spark 4.2 removes GeographyVal / GeometryVal and replaces getGeography / getGeometry on SpecializedGetters with a single getBinaryView returning BinaryView. CometInternalRowShim can no longer be shared from the spark-4.1+ source root, because the major, minor-plus and minor shim directories are all compile source roots (a spark-4.2 copy would be a duplicate class, not an override). It is split into per-version spark-4.1 and spark-4.2 copies.

Spark SQL test diff

  • dev/diffs/4.2.0.diff replaces dev/diffs/4.2.0-preview4.diff, reseeded from 4.1.2.diff against the v4.2.0 tag.
  • The main reconciliation is upstream's test-harness refactor: SQLTestUtils shrinks to a deprecated empty alias, and withSQLConf, stripSparkFilter and the test() override move into QueryTest, with SharedSparkSession now extending QueryTest directly. Comet's hooks (isCometEnabled, the IgnoreComet skip, and the stripSparkFilter Comet cases) move to QueryTest accordingly. isCometEnabled must qualify classic.SparkSession, since a bare SparkSession in that package resolves to the unified class.
  • KeyGroupedPartitioningSuite needs no Comet change any more: 4.2 already declares collectAllShuffles / collectShuffles as protected returning Seq[ShuffleExchangeLike].
  • HiveUDFDynamicLoadSuite drops Comet's commented-out assume: 4.2 adds TestHiveUdfsJar, which builds hive-test-udfs.jar from Java sources at runtime, so the stripped-jar workaround is obsolete.

CI

  • Adds a spark_4_2 job to the ci.yml umbrella calling spark_sql_test_reusable.yml (Spark 4.2.0, JDK 17), plus the matching spark_4_2 filter in compute-changes.py and output on the changes job. It is gated behind a run-spark-4.2-tests label so it runs on pushes to main but stays off the default PR path while 4.2 is experimental.

Plan stability

  • Regenerated with dev/regenerate-golden-files.sh --spark-version 4.2. The q2, q5, q54 (v1_4) and q5a (v2_7) goldens are pruned because their plans now match the shared fallback on the released 4.2.0, so the preview4-era divergences are gone.
  • q77a (v2_7) is added and records a degraded plan: Spark 4.2 plans a OneRowRelation into its Union branches, which Comet cannot convert, so the Unions fall back and the aggregates above lose their Comet partial producer. Tracked in Spark 4.2: OneRowRelation in Union branches forces Union and downstream aggregates off Comet (TPC-DS q77a) #4949 and to be removed when that is fixed.

Docs

  • User guide lists 4.2.0 (rather than preview4) in the experimental table, with Comet and Spark SQL tests now running in CI.
  • The new-Spark-version contributor guide described the spark_sql_test.yml matrix, which has since been replaced by the per-version umbrella jobs; it now documents the ci.yml + compute-changes.py wiring.

How are these changes tested?

  • ./mvnw -Pspark-4.2 install against the released 4.2.0 builds clean, as does -Pspark-4.1, confirming the shim split does not regress 4.1.
  • dev/diffs/4.2.0.diff was verified to apply with no rejects to a pristine v4.2.0 checkout, and patches the same 95 files as 4.1.2.diff, differing only by the expected SQLTestUtils to QueryTest swap.
  • CometTPCDSV1_4_PlanStabilitySuite and CometTPCDSV2_7_PlanStabilitySuite pass under -Pspark-4.2 (103 and 32 tests, no failures).
  • The new spark_4_2 job exercises the diff in CI; the run-spark-4.2-tests label is applied to this PR.

andygrove added 9 commits May 4, 2026 09:00
Adds dev/diffs/4.2.0-preview4.diff so the Spark SQL test suite can run
against Apache Spark 4.2.0-preview4 with Comet enabled, and wires the
4.2 profile into the spark_sql_test workflow matrix. The diff was
seeded from 4.1.1.diff and reconciled against v4.2.0-preview4.
Inherited from 4.1.1.diff during reconciliation. The Spark build was
trying to resolve comet-spark-spark4.1_2.13 instead of the 4.2 artifact,
causing the sql_hive jobs to fail before any tests ran.
Spark 4.2 removes GeographyVal / GeometryVal and replaces the getGeography
and getGeometry accessors on SpecializedGetters with a single getBinaryView
returning BinaryView. The shim therefore can no longer be shared between 4.1
and 4.2 out of the spark-4.1+ source root: the major, minor-plus and minor
shim directories are all added as compile source roots, so a spark-4.2 copy
would be a duplicate class rather than an override.

Move the trait into per-version spark-4.1 and spark-4.2 copies.
Point spark.version at the released 4.2.0 instead of 4.2.0-preview4.

Spark 4.2.0 bundles its own copy of
org.apache.datasketches.memory.internal.ResourceImpl inside spark-catalyst,
which collides with the transitive datasketches-memory jar and fails the
maven-enforcer BanDuplicateClasses rule, so ignore that class.

Keep the test-scope Jetty pin at 11.0.26. Spark 4.2.0 ships Jetty 12, but the
Iceberg REST catalog test helper needs jetty-servlet, which Jetty 12 replaced
with jetty-ee10-servlet.
Reseed the Spark SQL test overrides from 4.1.2.diff against the v4.2.0 tag and
drop the 4.2.0-preview4 diff.

The notable reconciliation is the test harness refactor: Spark 4.2 shrinks
SQLTestUtils to a deprecated empty alias and moves withSQLConf,
stripSparkFilter and the test() override into QueryTest, with
SharedSparkSession now extending QueryTest directly. Comet's hooks
(isCometEnabled, the IgnoreComet skip and the stripSparkFilter Comet cases)
move to QueryTest accordingly. isCometEnabled has to qualify
classic.SparkSession there, since a bare SparkSession in that package resolves
to the unified class.
Regenerated with dev/regenerate-golden-files.sh --spark-version 4.2.

The q2, q5, q54 (v1_4) and q5a (v2_7) goldens are pruned: their plans now match
the shared fallback under the released 4.2.0, so the divergences seen on
4.2.0-preview4 are gone.

q77a (v2_7) is added because Spark 4.2 plans a OneRowRelation into its Union
branches. Comet cannot convert that leaf, so the Unions fall back and the
aggregates above them lose their Comet partial producer. The approved plan
records the degraded plan; see apache#4949.
Add a spark_4_2 job to the ci.yml umbrella calling spark_sql_test_reusable.yml
with Spark 4.2.0 on JDK 17, plus the matching spark_4_2 filter in
compute-changes.py and output on the changes job. Gate it behind the
run-spark-4.2-tests label so it runs on pushes to main but stays off the
default PR path while 4.2 support is experimental.

Update the user guide for the released 4.2.0 and refresh the new-Spark-version
contributor guide, which still described the spark_sql_test.yml matrix that was
replaced by the per-version umbrella jobs.
@andygrove andygrove added the run-spark-4.2-tests Run the Spark 4.2 SQL tests on this PR label Jul 16, 2026
The preflight job only proceeds on a labeled event for known gating labels.
Without run-spark-4.2-tests in that allowlist, labelling a PR to request the
Spark 4.2 SQL tests skipped the whole pipeline instead of running them.
Comment thread .github/workflows/ci.yml
Comment on lines +268 to +284
spark_4_2:
name: Spark SQL Tests (Spark 4.2)
needs: changes
# Main-only by default; PRs need the `run-spark-4.2-tests` label. Spark 4.2
# support is still experimental, so keep it off the default PR path.
if: |
needs.changes.outputs.spark_4_2 == 'true' &&
(github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'run-spark-4.2-tests')))
uses: ./.github/workflows/spark_sql_test_reusable.yml
with:
spark-short: '4.2'
spark-full: '4.2.0'
java: 17

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

Labels

run-spark-4.2-tests Run the Spark 4.2 SQL tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants