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

fix(executor): limit should exit early when offset and limit are both 0 #506

Merged
merged 1 commit into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions src/executor/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ impl LimitExecutor {
let batch = batch?;
if dummy_chunk.is_none() {
dummy_chunk = Some(batch.slice(0..0));
if self.offset == 0 && self.limit == 0 {
break;
}
}
let cardinality = batch.cardinality();
let start = processed.max(self.offset) - processed;
Expand Down
8 changes: 8 additions & 0 deletions tests/sql/limit.slt
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ select v1 from t limit 0
query I
select v1 from t offset 5
----

# test case for https://github.com/risinglightdb/risinglight/issues/264
statement ok
insert into t values (1, 1)

query I
select v1 from t limit 0
----