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

   ### Describe the bug
   
   I look the discussion in 
https://github.com/apache/arrow-datafusion/issues/8296 , find we don't unifies 
projection if the expression is non-trival.
   But when I check in main, I find `projection_pushdown` rule unifies the 
non-trival projection. We should don't unifies it.
   ```
   ❯ create table t(a bigint);
   0 rows in set. Query took 0.007 seconds.
   
   ❯ explain select a/2, a/2+1 from t;
   
+---------------+-----------------------------------------------------------------------------------------------------------------+
   | plan_type     | plan                                                       
                                                     |
   
+---------------+-----------------------------------------------------------------------------------------------------------------+
   | logical_plan  | Projection: t.a / Int64(2)Int64(2)t.a AS t.a / Int64(2), 
t.a / Int64(2)Int64(2)t.a AS t.a / Int64(2) + Int64(1) |
   |               |   Projection: t.a / Int64(2) AS t.a / Int64(2)Int64(2)t.a  
                                                     |
   |               |     TableScan: t projection=[a]                            
                                                     |
   | physical_plan | ProjectionExec: expr=[a@0 / 2 as t.a / Int64(2), a@0 / 2 + 
1 as t.a / Int64(2) + Int64(1)]                      |
   |               |   MemoryExec: partitions=1, partition_sizes=[0]            
                                                     |
   |               |                                                            
                                                     |
   
+---------------+-----------------------------------------------------------------------------------------------------------------+
   2 rows in set. Query took 0.009 seconds.
   ```
   ```
   | physical_plan after OutputRequirements                     | 
ProjectionExec: expr=[t.a / Int64(2)Int64(2)t.a@0 as t.a / Int64(2), t.a / 
Int64(2)Int64(2)t.a@0 + 1 as t.a / Int64(2) + Int64(1)]                         
                                           |
   |                                                            |   
ProjectionExec: expr=[a@0 / 2 as t.a / Int64(2)Int64(2)t.a]                     
                                                                                
                                    |
   |                                                            |     
MemoryExec: partitions=1, partition_sizes=[0]                                   
                                                                                
                                  |
   |                                                            |               
                                                                                
                                                                                
                        |
   | physical_plan after PipelineChecker                        | SAME TEXT AS 
ABOVE                                                                           
                                                                                
                         |
   | physical_plan after LimitAggregation                       | SAME TEXT AS 
ABOVE                                                                           
                                                                                
                         |
   | physical_plan after ProjectionPushdown                     | 
ProjectionExec: expr=[a@0 / 2 as t.a / Int64(2), a@0 / 2 + 1 as t.a / Int64(2) 
+ Int64(1)]                                                                     
                                       |
   |                                                            |   MemoryExec: 
partitions=1, partition_sizes=[0] 
   ```
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   we don't unifies projection if the expression in not trival.
   
   ### Additional context
   
   _No response_


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