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(storage): support excluded bound in storage table #20138

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
54 changes: 54 additions & 0 deletions e2e_test/batch/issue_16219.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This is a test on a panic in select with excluded upper bound: https://github.com/risingwavelabs/risingwave/issues/16219

statement ok
SET RW_IMPLICIT_FLUSH TO true;

statement ok
create table t (a varchar);

statement ok
create materialized view mv as select * from t order by a desc;

query T
select * from mv where a < '';
----

query T
select * from mv where a > '';
----

query T
select * from mv where a <= '';
----

query T
select * from mv where a >= '';
----

statement ok
INSERT INTO t VALUES ('foo');

query T
select * from mv where a < '';
----

query T
select * from mv where a > '';
----
foo

query T
select * from mv where a <= '';
----


query T
select * from mv where a >= '';
----
foo

statement ok
drop materialized view mv;

statement ok
drop table t;
12 changes: 1 addition & 11 deletions src/storage/src/table/batch_table/storage_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,17 +717,7 @@ impl<S: StateStore, SD: ValueRowSerde> StorageTableInner<S, SD> {
let pk_prefix_serializer = self.pk_serializer.prefix(pk_prefix.len() + k.len());
let key = pk_prefix.chain(k);
let serialized_key = serialize_pk(&key, &pk_prefix_serializer);
if is_start_bound {
// Storage doesn't support excluded begin key yet, so transform it to
// included.
// We always serialize a u8 for null of datum which is not equal to '\xff',
// so we can assert that the next_key would never be empty.
let next_serialized_key = next_key(&serialized_key);
assert!(!next_serialized_key.is_empty());
Included(Bytes::from(next_serialized_key))
} else {
Excluded(serialized_key)
}
Excluded(serialized_key)
}
Unbounded => {
let pk_prefix_serializer = self.pk_serializer.prefix(pk_prefix.len());
Expand Down
Loading