-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Support limit push down for offset_plan #2566
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
Changes from 4 commits
35bbdd5
a6aaed5
302fd4b
27879cc
365dbf0
20366bd
aa87825
59a1813
613de25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is an
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. form the explain from pg I think in PG, the limit operator has a param with add test #2566 (comment) |
||
| } | ||
|
|
||
| fn set_expr_to_plan( | ||
|
|
@@ -4825,8 +4826,8 @@ mod tests { | |
| #[test] | ||
| fn test_offset_with_limit() { | ||
| let sql = "select id from person where person.id > 100 LIMIT 5 OFFSET 0;"; | ||
| let expected = "Limit: 5\ | ||
| \n Offset: 0\ | ||
| let expected = "Offset: 0\ | ||
| \n Limit: 5\ | ||
| \n Projection: #person.id\ | ||
| \n Filter: #person.id > Int64(100)\ | ||
| \n TableScan: person projection=None"; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.