Skip to content

[MINOR][CORE] Remove residual Spark 3.2 compatibility code in gluten-core#12522

Merged
jackylee-ch merged 1 commit into
apache:mainfrom
LuciferYang:gluten-minor-core-spark32-residual
Jul 16, 2026
Merged

[MINOR][CORE] Remove residual Spark 3.2 compatibility code in gluten-core#12522
jackylee-ch merged 1 commit into
apache:mainfrom
LuciferYang:gluten-minor-core-spark32-residual

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Spark 3.2 support was removed in prior PRs (#11351, #11687, #11731, #11887); currently supported versions are Spark 3.3, 3.4, 3.5, 4.0, 4.1. A few symbols that existed only as pre-Spark-3.3 shims are still around and dead code today.

  1. GlutenPlan.SupportsRowBasedCompatible trait

    Introduced to provide def supportsRowBased(): Boolean for Spark < 3.3 where SparkPlan.supportsRowBased did not exist yet. The default body was throw new GlutenException("Illegal state: The method is not expected to be called"). On Spark 3.3+, SparkPlan.supportsRowBased is native and every concrete GlutenPlan / ColumnarInputAdapter overrides it directly, so the trait's default was already unreachable. Drop the trait and its two mixin sites.

  2. SparkVersionUtil.gteSpark33

    Always true after Spark 3.2 was dropped. Also drop the single caller guard in canPropagateConvention (Transitions), which no longer needs to skip UnionExec on Spark 3.2. eqSpark33 and comparedWithSpark33 are kept: they distinguish Spark 3.3 from 3.4+ (different TaskContextImpl ctor signature and different write planning API), which is unrelated to the Spark 3.2 residual concern.

  3. SparkPlanUtil.supportsRowBased reflection

    The reflection was needed on Spark 3.2 because SparkPlan.supportsRowBased did not exist as a member yet; the same compiled artifact ran on 3.2 and 3.3+ only by resolving the method reflectively at call time. Now that Spark 3.2 is dropped, a direct call plan.supportsRowBased compiles on all supported profiles and is strictly better (primitive Boolean instead of boxed, no per-call getMethod lookup, no InvocationTargetException wrapping). The 3 callers in ConventionFunc are on the planning hot path.

How was this patch tested?

Verified via compile on Spark 3.3, 3.5, and 4.1 (scala-2.13) profiles, plus gluten-core and gluten-substrait tests on Spark 3.5. All 27 + 45 unit tests pass. scalastyle and spotless clean.

…core

Spark 3.2 support was removed in prior PRs (apache#11351, apache#11687, apache#11731, apache#11887);
currently supported versions are Spark 3.3, 3.4, 3.5, 4.0, 4.1. A few symbols
that existed only as pre-Spark-3.3 shims are still around and dead code today.

1. `GlutenPlan.SupportsRowBasedCompatible` trait

   Introduced to provide `def supportsRowBased(): Boolean` for Spark < 3.3
   where `SparkPlan.supportsRowBased` did not exist yet. The default body was
   `throw new GlutenException("Illegal state: The method is not expected to
   be called")`. On Spark 3.3+, `SparkPlan.supportsRowBased` is native and
   every concrete GlutenPlan / ColumnarInputAdapter overrides it directly, so
   the trait's default was already unreachable. Drop the trait and its two
   mixin sites.

2. `SparkVersionUtil.gteSpark33`

   Always true after Spark 3.2 was dropped. Also drop the single caller
   guard in `canPropagateConvention` (Transitions), which no longer needs to
   skip UnionExec on Spark 3.2. `eqSpark33` and `comparedWithSpark33` are
   kept: they distinguish Spark 3.3 from 3.4+ (different `TaskContextImpl`
   ctor signature and different write planning API), which is unrelated to
   the Spark 3.2 residual concern.

3. `SparkPlanUtil.supportsRowBased` reflection

   The reflection was needed on Spark 3.2 because `SparkPlan.supportsRowBased`
   did not exist as a member yet; the same compiled artifact ran on 3.2 and
   3.3+ only by resolving the method reflectively at call time. Now that
   Spark 3.2 is dropped, a direct call `plan.supportsRowBased` compiles on
   all supported profiles and is strictly better (primitive Boolean instead
   of boxed, no per-call `getMethod` lookup, no `InvocationTargetException`
   wrapping). The 3 callers in `ConventionFunc` are on the planning hot
   path.

Verified via compile on Spark 3.3, 3.5, and 4.1 (scala-2.13) profiles, plus
gluten-core and gluten-substrait tests on Spark 3.5.
Copilot AI review requested due to automatic review settings July 15, 2026 09:34
@LuciferYang

Copy link
Copy Markdown
Contributor Author

cc @jackylee-ch FYI,this is the first one and there are several more to follow.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Removes remaining Spark 3.2 compatibility shims and related dead code paths now that supported Spark versions start from 3.3.

Changes:

  • Removed the GlutenPlan.SupportsRowBasedCompatible shim trait and its mixin sites.
  • Deleted SparkVersionUtil.gteSpark33 and simplified canPropagateConvention by removing the no-longer-needed Spark 3.2 guard for UnionExec.
  • Replaced reflective supportsRowBased lookup with a direct plan.supportsRowBased call.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
gluten-substrait/src/main/scala/org/apache/spark/sql/execution/ColumnarCollapseTransformStages.scala Drops the legacy SupportsRowBasedCompatible mixin from ColumnarInputAdapter.
gluten-core/src/main/scala/org/apache/spark/util/SparkVersionUtil.scala Removes gteSpark33 which is always true with Spark 3.2 dropped.
gluten-core/src/main/scala/org/apache/spark/util/SparkPlanUtil.scala Switches supportsRowBased from reflection to direct API call.
gluten-core/src/main/scala/org/apache/gluten/extension/columnar/transition/package.scala Removes Spark-version gating and unused import; UnionExec is now always convention-propagatable.
gluten-core/src/main/scala/org/apache/gluten/execution/GlutenPlan.scala Removes the Spark<3.3 shim trait and updates related Scaladoc/imports.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions Bot added the CORE works for Gluten Core label Jul 15, 2026
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@zml1206 zml1206 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks, waiting for CI.

@jackylee-ch jackylee-ch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jackylee-ch

Copy link
Copy Markdown
Contributor

Run Gluten Clickhouse CI on x86

@jackylee-ch jackylee-ch merged commit b1e0072 into apache:main Jul 16, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants