简体   繁体   中英

How to use relational operators in map type in cassandra?

create table tbl_master_values (
dbid int primary key,
user_dbid int, reg_dbid int,
module_dbid int,
fields_value map<text,frozen<list<text>>>,
created_date timestamp,
modified_date timestamp);

CREATE INDEX idx_fields_value ON tbl_master_values (Entries(fields_value));

fields_value column contain this value:

{'287': ['28'], '288': [''], '289': [''], '291': ['33'], '295': [''],'309': ['214', '215']}

Now I want like this:

select * from tbl_master_values where fields_value['287'] > 20;

It's shows following error

InvalidRequest: code=2200 [Invalid query] message="Only EQ relations are supported on map entries"

InvalidRequest: code=2200 [Invalid query] message="Only EQ relations are supported on map entries"

It's pretty clear. No you can't do range scan (eg inequality relation) with native Cassandra secondary index, it's just not possible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM