Ted-Jiang commented on code in PR #2566:
URL: https://github.com/apache/arrow-datafusion/pull/2566#discussion_r877769008
##########
datafusion/core/src/sql/planner.rs:
##########
@@ -296,9 +296,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
let plan = self.order_by(plan, query.order_by)?;
- let plan: LogicalPlan = self.offset(plan, query.offset)?;
+ let plan: LogicalPlan = self.limit(plan, query.limit)?;
- self.limit(plan, query.limit)
+ //make limit as offset's input will enable limit push down simply
+ self.offset(plan, query.offset)
Review Comment:
form the explain from pg
```
postgres=# explain analyze select * from users limit 5 offset 7;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------
Limit (cost=0.17..0.29 rows=5 width=80) (actual time=0.117..0.226 rows=5
loops=1)
-> Seq Scan on users (cost=0.00..239.02 rows=10002 width=80) (actual
time=0.013..0.082 rows=12 loops=1)
Planning Time: 0.060 ms
Execution Time: 0.350 ms
(4 rows)
```
I think in PG, the limit operator has a param with `offset`, in DF we
separate it. So we need apply offset after limit `a+b`
--
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]