debug: config-gated assertion for columnar-to-row transition invariant [do not merge]#3966
Draft
andygrove wants to merge 4 commits intoapache:mainfrom
Draft
debug: config-gated assertion for columnar-to-row transition invariant [do not merge]#3966andygrove wants to merge 4 commits intoapache:mainfrom
andygrove wants to merge 4 commits intoapache:mainfrom
Conversation
Diagnostic-only assertion in EliminateRedundantTransitions to surface an intermittent bad-plan shape reported after apache#3879 (DPP shuffle fallback). Every ColumnarToRowExec / CometColumnarToRowExec / CometNativeColumnarToRowExec in the post-rule plan must have child.supportsColumnar == true. Not intended for merge. Remove once the root cause is identified.
…nabled Converts the columnar-to-row invariant check in EliminateRedundantTransitions from an always-on assertion into an off-by-default diagnostic config, so the check stays available for future transition regressions without runtime cost in production.
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.
Which issue does this PR close?
Diagnostic probe for a customer-reported issue following #3879. No issue filed yet.
Rationale for this change
A user reports a plan in which Spark's `ColumnarToRowExec` ends up wrapping a child whose `supportsColumnar == false`. The initial plan (before AQE) is clean; the bad shape emerges after AQE re-planning. Not reproduced locally across several configuration sweeps.
This adds an off-by-default diagnostic that surfaces the bad plan as a loud driver-side failure with the full offending subtree, instead of a runtime symptom that is hard to trace back. Leaving it in as a gated config means it stays available for future transition regressions at zero production cost.
What changes are included in this PR?
New config `spark.comet.assertValidPlanTransitions.enabled` (default: `false`) under the `exec_explain` category.
When enabled, `EliminateRedundantTransitions.apply` walks the post-rule plan and throws `IllegalStateException` if any of the following wraps a non-columnar child:
The exception message includes the offending child's class name and the full `treeString`.
How are these changes tested?
Built against `main` and exercised a local DPP + AQE sweep (V1/V2 sources, skew/coalesce, chained joins) with the config enabled. The assertion does not fire on clean plans. The intent is for the customer to set the flag and re-run their failing query so we can capture the offending plan shape.