Cassandra选择查询失败
我们有一张桌子:Cassandra选择查询失败,cassandra,cassandra-3.0,Cassandra,Cassandra 3.0,我们有一张桌子: CREATE TABLE table ( col1 text, col2 text, col3 timestamp, cl4 int, col5 timestamp, PRIMARY KEY (col1, col2, col3, col4) ) WITH CLUSTERING ORDER BY (col2 DESC, col3 DESC,col4 DESC) 当我尝试从此表进行查询时,如: select * from tabl
CREATE TABLE table (
col1 text,
col2 text,
col3 timestamp,
cl4 int,
col5 timestamp,
PRIMARY KEY (col1, col2, col3, col4)
) WITH CLUSTERING ORDER BY (col2 DESC, col3 DESC,col4 DESC)
当我尝试从此表进行查询时,如:
select * from table where col1 = 'something' and col3 < 'something'
and col4= 12 limit 5 ALLOW FILTERING;
select * from table where col1 = 'something' and col4 < 23
and col3 >= 'something' ALLOW FILTERING;
从表中选择*,其中col1='something'和col3<'something'
col4=12,限值5允许过滤;
从col1='something'和col4<23的表中选择*
和col3>=“某物”允许过滤;
我总是会遇到错误:不能限制集群列“col4”(前面的列“col3”受非EQ关系限制)
我试图通过生成col4、col3、col2来更改表的创建,但第二个查询不起作用,并引发了类似的错误。任何解决此问题的建议/建议
我们使用的是:Cassandra 3.0.17.7。您只能在查询分区的最后一列使用非相等条件
例如,您可以使用
col1=val和col2。请阅读此内容-如果您的查询不打算使用col2
,那么为什么要将其作为集群列?将其从主键def中取出(或使其成为最后一个群集列),然后您就不需要允许筛选了。