andygrove commented on code in PR #2566:
URL: https://github.com/apache/arrow-datafusion/pull/2566#discussion_r877123722


##########
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:
   Don't we need to apply the offset before the limit here?
   
   It looks like we don't currently have a test with both a non-zero offset and 
a limit. Could you add one here so we can see what the plan looks like?
   
   Per https://www.postgresql.org/docs/current/queries-limit.html `If both 
OFFSET and LIMIT appear, then OFFSET rows are skipped before starting to count 
the LIMIT rows that are returned.` and I am not sure this change will ensure 
that



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