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

   ### Is your feature request related to a problem or challenge?
   
   ```sql
   ❯ explain select * from t where a > 1 and a < 1;
   
+---------------+-------------------------------------------------------------------------------+
   | plan_type     | plan                                                       
                   |
   
+---------------+-------------------------------------------------------------------------------+
   | logical_plan  | Filter: t.a > Int32(1) AND t.a < Int32(1)                  
                   |
   |               |   TableScan: t projection=[a, b]                           
                   |
   | physical_plan | CoalesceBatchesExec: target_batch_size=8192                
                   |
   |               |   FilterExec: a@0 > 1 AND a@0 < 1                          
                   |
   |               |     MemoryExec: partitions=10, partition_sizes=[1, 0, 0, 
0, 0, 0, 0, 0, 0, 0] |
   |               |                                                            
                   |
   
+---------------+-------------------------------------------------------------------------------+
   ```
   Datafusion needs to scan table t and execute the filter, although it's 
unnecessary.
   
   
   ### Describe the solution you'd like
   
   Add an optimizer rule to simplify this predicate to a constant bool value 
and make the logical plan equal to 'select * from t where false' like 
   ```sql
   ❯ explain select * from t where false;
   +---------------+----------------------------------+
   | plan_type     | plan                             |
   +---------------+----------------------------------+
   | logical_plan  | EmptyRelation                    |
   | physical_plan | EmptyExec: produce_one_row=false |
   |               |                                  |
   +---------------+----------------------------------+
   ```
   
   ### Describe alternatives you've considered
   
   _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: [email protected]

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

Reply via email to