andygrove opened a new issue, #3248:
URL: https://github.com/apache/arrow-datafusion/issues/3248

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   PR https://github.com/apache/arrow-datafusion/pull/3242 fixes a correctness 
issue where a projection was being ignored. However, the physical plan now 
contains a redundant projection and it would be good to remove it.
   
   Example:
   
   ```
   DataFusion CLI v11.0.0
   ❯ create view v as select 1 as a, 2 as b, 3 as c;
   0 rows in set. Query took 0.002 seconds.
   
   ❯ explain select * from (select b from v);
   +---------------+---------------------------------------+
   | plan_type     | plan                                  |
   +---------------+---------------------------------------+
   | logical_plan  | Projection: #v.b                      |
   |               |   TableScan: v projection=[b]         |
   | physical_plan | ProjectionExec: expr=[b@0 as b]       |
   |               |   ProjectionExec: expr=[b@0 as b]     |
   |               |     ProjectionExec: expr=[2 as b]     |
   |               |       EmptyExec: produce_one_row=true |
   |               |                                       |
   +---------------+---------------------------------------+
   2 rows in set. Query took 0.009 seconds.
   ```
   The physical plan returned from `ViewTable::scan` is:
   
   ```
   ProjectionExec: expr=[b@0 as b]
     ProjectionExec: expr=[2 as b]
       EmptyExec: produce_one_row=true
   ```
   
   The physical plan shown in the `EXPLAIN` query above has an additional 
redundant projection added.
   
   **Describe the solution you'd like**
   Remove the redundant projection.
   
   **Describe alternatives you've considered**
   None
   
   **Additional context**
   None


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to