【发布时间】:2017-09-10 12:56:37
【问题描述】:
我有一个与此非常相似的架构:-
create table x(id int, start_date timestamp, end_date timestamp,
primary key((id), start_date, end_date))
with clustering order by (start_date desc, end_date desc);
现在我遇到了一个问题,我必须在开始日期和结束日期之间进行查询。像这样:-
select count(*) from x where id=2 and start_date > 'date' and end_date < 'date' ;
但它给了我一个类似于以下的错误:-
InvalidRequest: code=2200 [Invalid query] message="PRIMARY KEY column "end_date"
cannot be restricted (preceding column "start_date" is restricted
by a non-EQ relation)"
我是 cassandra 的新手,欢迎任何和所有建议,即使它需要我们进行架构更改。 :)
【问题讨论】: