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

   **Describe the bug**
   A clear and concise description of what the bug is.
   
   When the child node of union contains `EmptyRelation`, the plan generated by 
optimization rule `propagate_empty_relation` is wrong.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   1. query
   
   ```sql
   create table m2(intt int) as select 1 as intt;
   
   explain
   SELECT 
     *
   FROM 
     m2 
   WHERE 
     false IS UNKNOWN 
   UNION ALL 
   SELECT 
     *
   FROM 
     m2 
   WHERE 
     NOT false IS UNKNOWN 
   UNION ALL 
   SELECT 
     *
   FROM 
     m2 
   WHERE 
     false IS UNKNOWN IS NULL;
   ```
   
   2. result
   ```
   +---------------+----------------------------------+
   | plan_type     | plan                             |
   +---------------+----------------------------------+
   | logical_plan  | EmptyRelation                    |
   | physical_plan | EmptyExec: produce_one_row=false |
   |               |                                  |
   +---------------+----------------------------------+
   ```
   
   **Expected behavior**
   A clear and concise description of what you expected to happen.
   
   ```
   +---------------+-------------------------------------------------+
   | plan_type     | plan                                            |
   +---------------+-------------------------------------------------+
   | logical_plan  | Projection: m2.intt                             |
   |               |   TableScan: m2 projection=[intt]               |
   | physical_plan | ProjectionExec: expr=[intt@0 as intt]           |
   |               |   MemoryExec: partitions=1, partition_sizes=[1] |
   |               |                                                 |
   +---------------+-------------------------------------------------+
   ```
   
   **Additional context**
   Add any other context about the problem here.
   


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