davidhewitt opened a new issue, #15387:
URL: https://github.com/apache/datafusion/issues/15387

   ### Describe the bug
   
   I am testing against Datafusion main 
(d68fca91fd4c73f2cd92d61d036bc0411a2ed826).
   
   With the query below I expect there to be no `FilterExec` because the 
condition is trivial `x = x`. But it is not eliminated.
   
   ### To Reproduce
   
   ```
   > explain with test AS (SELECT unnest(generate_series(1, 10)) as x)
   select count(*) from test WHERE x = x;
   
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | plan_type     | plan                                                       
                                                                                
                       |
   
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | logical_plan  | Projection: count(Int64(1)) AS count(*)                    
                                                                                
                       |
   |               |   Aggregate: groupBy=[[]], aggr=[[count(Int64(1))]]        
                                                                                
                       |
   |               |     SubqueryAlias: test                                    
                                                                                
                       |
   |               |       Projection:                                          
                                                                                
                       |
   |               |         Filter: 
__unnest_placeholder(generate_series(Int64(1),Int64(10)),depth=1) = 
__unnest_placeholder(generate_series(Int64(1),Int64(10)),depth=1)             |
   |               |           Unnest: 
lists[__unnest_placeholder(generate_series(Int64(1),Int64(10)))|depth=1] 
structs[]                                                              |
   |               |             Projection: List([1, 2, 3, 4, 5, 6, 7, 8, 9, 
10]) AS __unnest_placeholder(generate_series(Int64(1),Int64(10)))               
                         |
   |               |               EmptyRelation                                
                                                                                
                       |
   | physical_plan | ProjectionExec: expr=[count(Int64(1))@0 as count(*)]       
                                                                                
                       |
   |               |   AggregateExec: mode=Final, gby=[], 
aggr=[count(Int64(1))]                                                          
                                             |
   |               |     CoalescePartitionsExec                                 
                                                                                
                       |
   |               |       AggregateExec: mode=Partial, gby=[], 
aggr=[count(Int64(1))]                                                          
                                       |
   |               |         ProjectionExec: expr=[]                            
                                                                                
                       |
   |               |           CoalesceBatchesExec: target_batch_size=8192      
                                                                                
                       |
   |               |             FilterExec: 
__unnest_placeholder(generate_series(Int64(1),Int64(10)),depth=1)@0 = 
__unnest_placeholder(generate_series(Int64(1),Int64(10)),depth=1)@0 |
   |               |               RepartitionExec: 
partitioning=RoundRobinBatch(8), input_partitions=1                             
                                                   |
   |               |                 UnnestExec                                 
                                                                                
                       |
   |               |                   ProjectionExec: expr=[[1, 2, 3, 4, 5, 6, 
7, 8, 9, 10] as __unnest_placeholder(generate_series(Int64(1),Int64(10)))]      
                       |
   |               |                     PlaceholderRowExec                     
                                                                                
                       |
   |               |                                                            
                                                                                
                       |
   
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   ```
   
   ### Expected behavior
   
   _No response_
   
   ### 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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to