[FLINK-40540][table-planner] Put the rule's reason first in the planning error - #29072
Merged
MartijnVisser merged 1 commit intoSep 4, 2026
Conversation
…ing error A rule that rejects a query already explains why, but the message buried that sentence behind the full logical plan. Put the reason on the header line and mark the plan with "Plan:" so that tools rewriting the message can find it. The wrapper type and cause chain stay as they are. A ValidationException thrown while applying a rule now gets the same treatment instead of leaking as Calcite's RuntimeException. Generated-by: Claude Code (Claude Fable 5.1)
MartijnVisser
force-pushed
the
FLINK-40540-reason-first-planning-error
branch
from
September 2, 2026 15:23
ee2b45c to
cc04471
Compare
Collaborator
Contributor
Author
|
@flinkbot run azure |
snuyanzin
approved these changes
Sep 4, 2026
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 is the purpose of the change
When a rule rejects a query during the Volcano phase,
FlinkVolcanoProgramwraps the exception as "Cannot generate a valid execution plan for the given query:" followed by the full logical plan and only then the rule's own message, so the actionable sentence is buried. AValidationExceptionthrown from a rule'sonMatch()is not caught at all and reaches users as Calcite's "Error while applying rule ..."RuntimeException.This change keeps the wrapper and its cause chain, so nothing matching on the header, the type or the cause is affected, but puts the rule's reason on the header line and lists the plan after a
Plan:marker so that tools rewriting the message can find it:Brief change log
FlinkVolcanoProgrambuilds one message layout forCannotPlanExceptionand for aTableExceptionorValidationExceptionthrown by a rule, looking through Calcite'sRuntimeExceptionwrapper; other exceptions propagate unchangedVerifying this change
This change is already covered by existing tests: all assertions on the header text, exception type and cause chain pass unchanged (
./mvnw verifyforflink-table-planner). Added assertions for the new layout inGroupWindowTest#testNonPartitionedSessionWindowandOverAggregateTest#testExclusionGroupIsNotSupported, and unit tests forFlinkVolcanoProgram#unwrapRuleException.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Fable 5.1)