我正在通过 FluentCassandra 和 C# 访问 Cassandra 1.2。我使用了 DataStax 安装包。我遇到的问题是我无法执行下面显示的范围查询。
我尝试了下表创建方法:
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))
这是查询:
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;
错误是:
“使用 Equal 运算符的 by-columns 子句中没有索引列”/“PRIMARY KEY 部分 p2 不能被限制(前面的部分 p1 要么不受限制,要么受非 EQ 关系限制)”
我的连接构建器:
ConnectionBuilder builder = new ConnectionBuilder(CDBkeyspace,
new Server("localhost"), true, 0, 100, 0, ConnectionType.Framed, 4096,
ConsistencyLevel.QUORUM, Apache.Cassandra.ConsistencyLevel.QUORUM, "3.0.0");
我该怎么做呢?