Dandandan opened a new issue #264:
URL: https://github.com/apache/arrow-datafusion/issues/264


   **Describe the bug**
   Projection is removed when it contains the same fields.
   This 
   
   **To Reproduce**
   
   ```sql
   
   > 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 be 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.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to