-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Support Limit pushdown for MemoryExec
#14502
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
Conversation
02efd60 to
13a0960
Compare
13a0960 to
38edfcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @zjregee ❤️
I have some small suggestions but we could do them as a follow on PR as well (they are not required to merge this PR in my opinion)
Thanks!
| projection: Option<Vec<usize>>, | ||
| /// Index into the data | ||
| index: usize, | ||
| /// The remaining number of rows to return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// The remaining number of rows to return | |
| /// The remaining number of rows to return. If None, all rows are returned |
| if self.fetch.is_none() { | ||
| return Poll::Ready(Some(Ok(batch))); | ||
| } | ||
|
|
||
| let fetch = self.fetch.unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can write this more concisely and avoid the unwrap with something like
| if self.fetch.is_none() { | |
| return Poll::Ready(Some(Ok(batch))); | |
| } | |
| let fetch = self.fetch.unwrap(); | |
| let Some(&fetch) = self.fetch.as_ref() else { | |
| return Poll::Ready(Some(Ok(batch))); | |
| }; |
| 05)--------MemoryExec: partitions=1, partition_sizes=[1] | ||
| 06)------GlobalLimitExec: skip=0, fetch=10 | ||
| 07)--------MemoryExec: partitions=1, partition_sizes=[1] | ||
| 04)------MemoryExec: partitions=1, partition_sizes=[1], limit=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
|
@alamb, this is subsumed by the unified source PR. Let's only merge this if we encounter an issue that will delay the other one, but let's hold off otherwise to avoid conflicts |
MemoryExec
Sounds good FWIW I think @ozankabak is talking about this PR: |
|
It seems that the suggestions mentioned here are still feasible. I will use a follow on PR to add this. |
Which issue does this PR close?
Closes #14337.
Rationale for this change
What changes are included in this PR?
Implement limit pushdown for MemoryExec, add unit test and modify outdated content in .slt test files.
Are these changes tested?
Yes.
Are there any user-facing changes?
None.