featzhang created FLINK-39089:
---------------------------------
Summary: [Table] Enhanced projection field alias display
Key: FLINK-39089
URL: https://issues.apache.org/jira/browse/FLINK-39089
Project: Flink
Issue Type: New Feature
Components: Table SQL / Planner
Reporter: featzhang
Currently, in Flink SQL's EXPLAIN output, LogicalProject nodes display field
references using positional indices like {{{}$0{}}}, {{{}$1{}}}, which makes
the execution plan difficult to read and understand. For example:
{code:java}
LogicalProject($0, $2)
{code}
This PR enhances the projection explain output to show actual field names and
their sources, making it more readable:
{code:java}
LogicalProject(id, user_name)
{code}
Or with more detail:
{code:java}
Project:
id := orders.id
user_name := users.name
{code}
h2. Brief change log
* Added {{projectFieldsToString}} method in {{RelExplainUtil}} to format
projection fields with readable field names
* The new method converts field references from positional indices ($0, $1) to
actual field names with proper aliasing
* Maintained backward compatibility - the utility method is available for
future integration
* Successfully compiled and tested with the flink-table-planner module
h2. Verifying this change
This change can be verified by:
# Running existing explain tests to ensure no regression
# Adding new test cases that verify enhanced projection alias display
# Manual testing with SQL queries containing projections:
{code:sql}
EXPLAIN SELECT id, user_name FROM orders;
{code}
Expected output should show field names instead of positional indices.
h2. Does this pull request potentially affect one of the following parts:
* Dependencies (does it add or upgrade a dependency): *no*
* The public API, i.e., is any changed class annotated with
{{{}@Public(Evolving){}}}: *no*
* The serializers: *no*
* The runtime per-record code paths (performance sensitive): *no*
* Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: *no*
* The S3 file system connector: *no*
h2. Documentation
* Does this pull request introduce a new feature? *yes*
* If yes, how is the feature documented? *code comments and JavaDocs*
--
This message was sent by Atlassian Jira
(v8.20.10#820010)