[FLINK-39090][SQL] Enhance structured condition display of Explain output#27610
Open
featzhang wants to merge 4 commits intoapache:masterfrom
Open
[FLINK-39090][SQL] Enhance structured condition display of Explain output#27610featzhang wants to merge 4 commits intoapache:masterfrom
featzhang wants to merge 4 commits intoapache:masterfrom
Conversation
Collaborator
358eded to
27780c0
Compare
56b1244 to
675130d
Compare
featzhang
added a commit
to featzhang/flink
that referenced
this pull request
Mar 18, 2026
…lain output This commit includes the following improvements: 1. Fix projection field alias display to avoid duplicate output - Enhanced projection field alias handling in RelTreeWriterImpl - Added utility method for enhanced projection field alias display - Integrated projection field alias enhancement into explain output 2. Enhance FlinkLogicalCalc explain output - Added structured filter condition display in explain output - Improved readability of FlinkLogicalCalc explain plans 3. Enhance FlinkLogicalJoin explain output - Added structured condition display in explain output - Improved readability of FlinkLogicalJoin explain plans 4. Code quality improvements - Removed demo test file - Auto-formatted code with spotless Changes affect: - 180 files total (111 modified) -主要集中在flink-table-planner模块 - 1909 insertions, 3005 deletions This fixes CI test failures related to projection field alias display and improves the overall explain output quality. Related: FLINK-39089, PR apache#27610
…ed filter condition display
This commit enhances the EXPLAIN output for FlinkLogicalCalc (Filter) to display filter conditions with actual field names instead of positional references, improving readability and debuggability.
Changes:
- Override explainTerms method in FlinkLogicalCalc class
- Add formatFilterCondition method to parse and format filter conditions
- Support common comparison operators (>, <, >=, <=, =, <>)
- Support logical operators (AND, OR, NOT)
- Fallback to default formatting for complex expressions
- Add unit tests for filter condition formatting
Example:
Before: Filter(condition=[>($2, 100)])
After: Filter:
amount > 100
This follows the same approach as FlinkLogicalJoin condition display and does not modify any query optimization logic.
Remove the demo test file. Actual testing should be done through updating XML files in existing test cases.
675130d to
da64458
Compare
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
This PR enhances the explain output of FlinkLogicalJoin to display join conditions in a more readable and structured format. Instead of showing low-level positional references like
=($0, $3), it now displays actual field names in a clear format.Before:
After:
Brief change log
explainTermsoverride method in FlinkLogicalJoin classformatJoinConditionmethod for recursive RexNode condition parsingformatOperandmethod for field reference resolutionVerifying this change
This change is a display-only enhancement and can be verified by:
Build the flink-table-planner module:
Run EXPLAIN queries in Flink SQL Client with joins:
Verify the join condition is displayed with field names instead of positional references
Does this pull request potentially affect one of the following parts:
@Public(Evolving): NoDocumentation
This change only enhances the explain output format and does not modify any RelNode structure, query optimization logic, or runtime behavior. It has zero impact on performance and is 100% backward compatible.