-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
❯ create view v as select 1 as a, 2 as b, 3 as c;
0 rows in set. Query took 0.010 seconds.
❯ explain select * from v offset 0 limit 2;
+---------------+-------------------------------------------------------+
| plan_type | plan |
+---------------+-------------------------------------------------------+
| logical_plan | Limit: skip=0, fetch=2 |
| | Projection: #v.a, #v.b, #v.c |
| | TableScan: v projection=[a, b, c], fetch=2 |
| physical_plan | GlobalLimitExec: skip=0, fetch=2 |
| | ProjectionExec: expr=[a@0 as a, b@1 as b, c@2 as c] |
| | ProjectionExec: expr=[1 as a, 2 as b, 3 as c] |
| | EmptyExec: produce_one_row=true |
| | |
+---------------+-------------------------------------------------------+
❯ explain select * from v limit 2;
+---------------+-------------------------------------------------------+
| plan_type | plan |
+---------------+-------------------------------------------------------+
| logical_plan | Limit: skip=None, fetch=2 |
| | Projection: #v.a, #v.b, #v.c |
| | TableScan: v projection=[a, b, c], fetch=2 |
| physical_plan | GlobalLimitExec: skip=None, fetch=2 |
| | ProjectionExec: expr=[a@0 as a, b@1 as b, c@2 as c] |
| | ProjectionExec: expr=[1 as a, 2 as b, 3 as c] |
| | EmptyExec: produce_one_row=true |
| | |
+---------------+-------------------------------------------------------+
I'd like explain select * from v offset 0 limit 2 and explain select * from v limit 2; to have same logical plan.
Also, in eliminate_limit.rs, we should eliminate the Limit plan when fetch = None and skip = 0 or skip = None.
https://github.com/apache/arrow-datafusion/blob/master/datafusion/optimizer/src/eliminate_limit.rs#L75-L91
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
We could not do this.
Additional context
Add any other context or screenshots about the feature request here.