Skip to content
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

Support limit offset as ExecNode #450

Merged
merged 8 commits into from
Jan 23, 2023
Merged

Support limit offset as ExecNode #450

merged 8 commits into from
Jan 23, 2023

Conversation

changhiskhan
Copy link
Contributor

No description provided.

@changhiskhan changhiskhan requested a review from eddyxu January 23, 2023 00:48
rust/src/io/exec/limit.rs Outdated Show resolved Hide resolved
let nrows = b.num_rows() as i64;
if off > 0 {
if off > nrows {
// skip this batch if offset is more than num rows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a todo to skip the read from child entirely if off > nrows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is only useful without any predicates so probably won't be very impactful

fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Pin::into_inner(self).rx.poll_recv(cx)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some tests?

/// Create a new execution node to handle limit offset.
pub fn new(
child: impl ExecNode + Unpin + Send + 'static,
limit: Option<i64>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should limit not a Option value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offline discussion: postgres supports offset without limit

@@ -147,6 +147,17 @@ impl<'a> Scanner {
Arc::new(projection.clone()),
flat_knn_node,
))
} else if self.limit.is_some() || self.offset.is_some() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this work with other scanner, i.e., KNN?
for example, should it be the front of the ExecNode so far.

Copy link
Contributor

@eddyxu eddyxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@changhiskhan changhiskhan merged commit 87ab318 into main Jan 23, 2023
@changhiskhan changhiskhan deleted the changhiskhan/limit branch January 23, 2023 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants