featzhang created FLINK-39090:
---------------------------------
Summary: [SQL] Enhanced join condition structured display
Key: FLINK-39090
URL: https://issues.apache.org/jira/browse/FLINK-39090
Project: Flink
Issue Type: Improvement
Components: Table SQL / Planner
Reporter: featzhang
Currently, the EXPLAIN output for FlinkLogicalJoin shows join conditions using
positional references (e.g., =($0, $3)), which makes it difficult for users to
understand the actual join logic, especially in complex queries with multiple
tables.
Example of current output:
{code:java}
Join(condition=[=($0, $3)])
{code}
This is not user-friendly because:
1. Users need to manually map positional indexes to field names
2. In complex queries with many fields, it's error-prone
3. It reduces SQL debuggability and readability
Proposed enhancement:
Display join conditions with actual field names in a structured format:
{code:java}
Join:
Type: INNER
Condition: orders.user_id = users.id
{code}
Benefits:
- Improved user experience and query debugging
- Better alignment with SQL semantics
- Easier to understand join logic at a glance
- No impact on RelNode structure or runtime performance
Implementation approach:
- Override explainTerms method in FlinkLogicalJoin class
- Parse RexNode conditions recursively
- Resolve field references to actual field names
- Support EQUALS, AND, OR operators
- Fallback to default formatting for complex expressions
This is a display-only enhancement and does not modify any query optimization
logic.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)