Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagating empty_relation generate an illegal plan #5218

Closed
yukkit opened this issue Feb 8, 2023 · 0 comments · Fixed by #5219
Closed

Propagating empty_relation generate an illegal plan #5218

yukkit opened this issue Feb 8, 2023 · 0 comments · Fixed by #5219
Labels
bug Something isn't working

Comments

@yukkit
Copy link
Contributor

yukkit commented Feb 8, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant