[GLUTEN-10992][VL] Fix MatchError for KeyGroupedPartitioning in native shuffle#12335
Open
brijrajk wants to merge 1 commit into
Open
[GLUTEN-10992][VL] Fix MatchError for KeyGroupedPartitioning in native shuffle#12335brijrajk wants to merge 1 commit into
brijrajk wants to merge 1 commit into
Conversation
…e shuffle 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. The default case in VeloxSparkPlanExecApi.genColumnarShuffleExchange created a ColumnarShuffleExchangeExec for this node, which then crashed with a scala.MatchError in ExecUtil.genShuffleDependency because KeyGroupedPartitioning was not handled in the native partitioning match. Fix by adding an explicit KeyGroupedPartitioning case to genColumnarShuffleExchange that marks the shuffle for fallback to vanilla Spark. Also harden ExecUtil.genShuffleDependency with an explicit wildcard that throws GlutenNotSupportException instead of a cryptic MatchError for any future unknown partitioning types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
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 aShuffleExchangeExecwithKeyGroupedPartitioningas its output partitioning.The default
case _ =>inVeloxSparkPlanExecApi.genColumnarShuffleExchangecreated aColumnarShuffleExchangeExecfor this node without validation. When the query executed,ExecUtil.genShuffleDependencycrashed with ascala.MatchErrorbecauseKeyGroupedPartitioningwas missing from its exhaustive match.Changes:
VeloxSparkPlanExecApi.genColumnarShuffleExchange: add an explicitcase _: KeyGroupedPartitioning =>before the default that adds a fallback tag and returns the vanillaShuffleExchangeExec. This prevents aColumnarShuffleExchangeExecfrom being created for an unsupported partitioning type.ExecUtil.genShuffleDependency: add an explicit wildcardcase other =>that throwsGlutenNotSupportExceptioninstead of the crypticscala.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 inGlutenKeyGroupedPartitioningSuite(both spark40 and spark41) reproduce the crash exactly — they setV2_BUCKETING_SHUFFLE_ENABLED=truewith only one bucketed side, which triggers aShuffleExchangeExecwithKeyGroupedPartitioningoutput and then callcheckAnswer. After this fix these tests pass withoutMatchError.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (https://claude.ai/code)
Related issue: #10992