无法在Cassandra 1.2中执行范围查询 [英] Unable to perform range queries in Cassandra 1.2

查看:293
本文介绍了无法在Cassandra 1.2中执行范围查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过FluentCassandra和C#访问Cassandra 1.2。我使用了DataStax安装包。我遇到的问题是我无法执行下面显示的范围查询。

I'm accessing Cassandra 1.2 via FluentCassandra and C#. I used the DataStax installation package. The issue I have is I cannot execute the range query I show below.

我试过下面的表创建方法:

I have tried the following table create methods:

CREATE TABLE Test (KEY text, p1 int, p2 int, p3 int, p4 int, p5 int, p6 int, 
p7 int, p8 int, data text, PRIMARY KEY (KEY))

CREATE TABLE Test (KEY text, p1 int, p2 int, p3 int, p4 int, p5 int, p6 int, 
p7 int, p8 int, data text, PRIMARY KEY (KEY, p1, p2, p3, p4, p5, p6, p7, p8))


$ b b

这里是查询:

Here is the query:

SELECT Data FROM Test WHERE KEY IN ('           0', '           1', 
'           2', '           3', '           4', '           5', '           6', 
'           7', '           8', '           9', '          10', '          11', 
'          12', '          13', '          14', '          15') AND 
p1 >= 10 AND p1 <= 40 AND p2 >= 20 AND p2 <= 80 AND 
p3 >= 30 AND p3 <= 120 AND p4 >= 40 AND p4 <= 160 AND 
p5 >= 50 AND p5 <= 200 AND p6 >= 60 AND p6 <= 240 AND 
p7 >= 70 AND p7 <= 280 AND p8 >= 80 AND p8 <= 320;

错误是:


没有索引的列存在于带有等于运算符的by-columns子句/
PRIMARY KEY part p2不能被限制(前面的部分p1是
不受限制或非EQ关系)

"No indexed columns present in by-columns clause with Equal operator" / "PRIMARY KEY part p2 cannot be restricted (preceding part p1 is either not restricted or by a non-EQ relation)"

我的ConnectionBuilder:

My ConnectionBuilder:

ConnectionBuilder builder = new ConnectionBuilder(CDBkeyspace, 
new Server("localhost"), true, 0, 100, 0, ConnectionType.Framed, 4096, 
ConsistencyLevel.QUORUM, Apache.Cassandra.ConsistencyLevel.QUORUM, "3.0.0");

如何做到这一点?

推荐答案

由于错误指定P2不能被限制UNLESS P1上有EQUAL运算符
所有参数,直到你指定的最后一个参数必须有相等性,只有最后一个可以有不相等

As the error specify P2 cannot be restricted UNLESS P1 has EQUAL operator on it ALL parameters until last one you specify must have equality and only the last one can have non-equality

这篇关于无法在Cassandra 1.2中执行范围查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆