brijrajk opened a new pull request, #12335:
URL: https://github.com/apache/gluten/pull/12335
## What changes were proposed in this pull request?
When Spark 4.0's V2 bucketing shuffle
(`spark.sql.v2.bucketing.shuffle.enabled=true`) is used in a join where only
one side reports partitioning, Spark generates a `ShuffleExchangeExec` with
`KeyGroupedPartitioning` as its output partitioning.
The default `case _ =>` in
`VeloxSparkPlanExecApi.genColumnarShuffleExchange` created a
`ColumnarShuffleExchangeExec` for this node without validation. When the query
executed, `ExecUtil.genShuffleDependency` crashed with a `scala.MatchError`
because `KeyGroupedPartitioning` was missing from its exhaustive match.
**Changes:**
- `VeloxSparkPlanExecApi.genColumnarShuffleExchange`: add an explicit `case
_: KeyGroupedPartitioning =>` before the default that adds a fallback tag and
returns the vanilla `ShuffleExchangeExec`. This prevents a
`ColumnarShuffleExchangeExec` from being created for an unsupported
partitioning type.
- `ExecUtil.genShuffleDependency`: add an explicit wildcard `case other =>`
that throws `GlutenNotSupportException` instead of the cryptic
`scala.MatchError`, as a defensive guard for any future unknown partitioning
types.
## How was this patch tested?
The existing `testGluten("SPARK-41471: shuffle one side: only one side
reports partitioning")` tests in `GlutenKeyGroupedPartitioningSuite` (both
spark40 and spark41) reproduce the crash exactly — they set
`V2_BUCKETING_SHUFFLE_ENABLED=true` with only one bucketed side, which triggers
a `ShuffleExchangeExec` with `KeyGroupedPartitioning` output and then call
`checkAnswer`. After this fix these tests pass without `MatchError`.
## Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (https://claude.ai/code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]