featzhang created FLINK-39091:
---------------------------------

             Summary: [SQL] Enhance structured filter condition display of 
Explain output
                 Key: FLINK-39091
                 URL: https://issues.apache.org/jira/browse/FLINK-39091
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / Planner
            Reporter: featzhang


Currently, the EXPLAIN output for FlinkLogicalCalc (Filter) shows filter 
conditions using positional references (e.g., >($2, 100)), which makes it 
difficult for users to understand the actual filter logic, especially in 
queries with many fields.

Example of current output:
{code}
Filter(condition=[>($2, 100)])
{code}

This is not user-friendly because:
1. Users need to manually map positional indexes to field names
2. In queries with many fields, it's error-prone
3. It reduces SQL debuggability and readability

Proposed enhancement:
Display filter conditions with actual field names in a structured format:

{code}
Filter:
  amount > 100
{code}

Benefits:
- Improved user experience and query debugging
- Better alignment with SQL semantics
- Easier to understand filter logic at a glance
- No impact on RelNode structure or runtime performance

Implementation approach:
- Override explainTerms method in FlinkLogicalCalc class
- Parse RexNode conditions recursively
- Resolve field references to actual field names
- Support common comparison operators (>, <, >=, <=, =, <>)
- Support logical operators (AND, OR, NOT)
- Fallback to default formatting for complex expressions

This is a display-only enhancement and does not modify any query optimization 
logic, following the same approach as the FlinkLogicalJoin condition display 
enhancement.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to