Skip to content

Commit

Permalink
Merge pull request #4907 from zhang2014/fix/ISSUE-4807
Browse files Browse the repository at this point in the history
fixes(limit): fixes limit and offset with one block
  • Loading branch information
BohuTANG authored Apr 18, 2022
2 parents ec64439 + 909f454 commit 3fc77dd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
17 changes: 14 additions & 3 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;
self.skip_remaining = 0;
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;
self.skip_remaining = 0;
Some(data_block.slice(offset, rows - offset))
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GITHUB GITHUB Storage Engine
MEMORY MEMORY 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;

0 comments on commit 3fc77dd

Please sign in to comment.