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

fixes(limit): fixes limit and offset with one block #4907

Merged
merged 6 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions query/src/pipelines/new/processors/transforms/transform_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,20 @@ impl<const MODE: usize> TransformLimitImpl<MODE> {
return None;
}

let remaining = self.skip_remaining;
self.skip_remaining = 0;
Some(data_block.slice(remaining, rows - remaining))

match MODE {
OFFSET_AND_LIMIT => {
let offset = self.skip_remaining;
let length = std::cmp::min(self.take_remaining, rows - offset);
self.take_remaining -= length;
Some(data_block.slice(offset, length))
}
_ => {
let offset = self.skip_remaining;
Some(data_block.slice(offset, rows - offset))
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FUSE FUSE Storage Engine
GITHUB GITHUB Storage Engine
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SELECT * FROM system.engines ORDER BY Engine LIMIT 1,2;