Skip to content

[MINOR][CORE] Fail fast in InsertTransitions when a child has no recognizable Convention#12442

Merged
zhztheplayer merged 1 commit into
apache:mainfrom
LuciferYang:gluten-insert-transitions-unrecognizable-child
Jul 6, 2026
Merged

[MINOR][CORE] Fail fast in InsertTransitions when a child has no recognizable Convention#12442
zhztheplayer merged 1 commit into
apache:mainfrom
LuciferYang:gluten-insert-transitions-unrecognizable-child

Conversation

@LuciferYang

@LuciferYang LuciferYang commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

InsertTransitions.applyForNode has a branch that handles the case where a child's Convention is isNone (row type and batch type both None) by returning the child unchanged. The pre-existing comment already notes that such a plan is not executable. No production plan reaches this branch today, but the silent fall-through would defer the failure to task execution. This PR replaces the silent no-op with a GlutenException that names the offending parent and child. The same latent hole exists in Transitions.enforceReq, which currently reaches assert(!from.isNone, ...) inside Transition.Factory#findTransition and raises an AssertionError without plan identity; the fix adds a symmetric pre-check there so both entry points behave the same way.

Why are the changes needed?

Defense-in-depth: keeps a code path that is currently unreachable from silently degrading if it ever does become reachable (e.g. a future GlutenPlan that inadvertently declares both types as None). No behavior change for any currently-shipping plan.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

mvn -pl gluten-core,gluten-substrait -am -Pspark-3.5 spotless:check passes. TransitionSuite gains three tests covering (1) an unexecutable child at position 0, (2) an unexecutable child at a non-first position under a binary parent, and (3) an unexecutable root plan routed through enforceReq. Each was verified against the pre-fix code and observed to fail with the expected signal. A new NoConventionLeaf fixture in TransitionSuiteBase supplies the rowType=None, batchType=None state.

Copilot AI review requested due to automatic review settings July 3, 2026 09:37
@github-actions github-actions Bot added the CORE works for Gluten Core label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

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

This PR makes transition insertion fail fast (at planning time) when a plan (or a child plan) has an unrecognizable Convention (rowType=None and batchType=None), replacing silent no-ops / assertion failures with a GlutenException that identifies the offending plan(s).

Changes:

  • In InsertTransitions.applyForNode, throw a GlutenException when a child’s derived Convention is isNone instead of returning the child unchanged.
  • In Transitions.enforceReq, add a symmetric root-level pre-check to throw a GlutenException rather than hitting an internal assert(!from.isNone) in Transition.Factory#findTransition.
  • Add Transition.notExecutable(...) helpers plus UT fixtures and tests to validate the new failure mode and error framing.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
gluten-substrait/src/test/scala/org/apache/gluten/extension/columnar/transition/TransitionSuiteBase.scala Adds a NoConventionLeaf test fixture representing rowType=None, batchType=None.
gluten-substrait/src/test/scala/org/apache/gluten/extension/columnar/transition/TransitionSuite.scala Adds tests asserting planning-time failures and message framing for child and root cases.
gluten-core/src/main/scala/org/apache/gluten/extension/columnar/transition/Transitions.scala Replaces silent handling of from.isNone with Transition.notExecutable and adds a root pre-check in enforceReq.
gluten-core/src/main/scala/org/apache/gluten/extension/columnar/transition/Transition.scala Introduces notExecutable exception constructors used by both entry points.

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

@LuciferYang LuciferYang force-pushed the gluten-insert-transitions-unrecognizable-child branch from 2935ce7 to 3bb2845 Compare July 3, 2026 09:58
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@zhztheplayer

Copy link
Copy Markdown
Member

but the silent fall-through would defer the failure to task execution with an error unrelated to the real cause.

Do you mean the error is thrown from Spark executor rather than at planning time?

@LuciferYang

Copy link
Copy Markdown
Contributor Author

Yes. If this branch were hit, no transition would be inserted for a child whose Convention is isNone, so the failure would surface in the executor at doExecute / doExecuteColumnar (or codegen) time. The branch is not currently reachable in production, so this PR is a defense-in-depth cleanup rather than a fix for an observed failure. I updated the PR body to drop the overreaching wording.

@zhztheplayer zhztheplayer merged commit 0a16d32 into apache:main Jul 6, 2026
61 of 62 checks passed
@LuciferYang LuciferYang deleted the gluten-insert-transitions-unrecognizable-child branch July 6, 2026 13:35
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.

3 participants