Skip to content

Planner don't generate SubqueryAlias #4483

@jackwener

Description

@jackwener

Describe the bug

To Reproduce

CREATE TABLE IF NOT EXISTS t1 AS VALUES(1,'HELLO'),(12,'DATAFUSION');
CREATE TABLE IF NOT EXISTS t2 AS VALUES(1,'HELLO'),(12,'DATAFUSION');

explain select * from ((select column1 from t1) INNER JOIN (select column1 from t2) on t1.column1 = t2.column1) as f;
+---------------+----------------------------------------------------------------------------------------------------------------------------------------+
| plan_type     | plan                                                                                                                                   |
+---------------+----------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan  | Projection: t1.column1, t2.column1                                                                                                     |
|               |   Inner Join: t1.column1 = t2.column1                                                                                                  |
|               |     Projection: t1.column1                                                                                                             |
|               |       TableScan: t1 projection=[column1]                                                                                               |
|               |     Projection: t2.column1                                                                                                             |
|               |       TableScan: t2 projection=[column1]                                                                                               |

There isn't subquery f
When we select f.column1 from ((select column1 from t1) INNER JOIN (select column1 from t2) on t1.column1 = t2.column1) as f;

We can't find f.column1, just exist t1.column1.

BTW, this plan is wrong.
Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions