-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Projection is removed when it contains the same fields.
This
To Reproduce
> select (1+1) as a from (select 1 as a);
+---+
| a |
+---+
| 1 |
+---+
1 rows in set. Query took 0 seconds.;Expected behavior
Should return 2 instead of reusing the expression from the field.
Additional context
The bug seems to originate from the project function https://github.com/apache/arrow-datafusion/blob/master/datafusion/src/sql/planner.rs#L652 .
I think when we remove the "optimization" to get rid of the projection, the query will return the correct result.
Removal of any redundant projections should move to a properly tested optimization pass rather than in the sql -> logical plan planner.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working