Cassandra-CQL OR运算符 [英] Cassandra - CQL OR Operator
本文介绍了Cassandra-CQL OR运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试学习卡桑德拉。我正在使用Windows社区版本(2.0)。
I am trying to learn cassandra. I am using windows community edition (2.0).
我的表模式为:
CREATE TABLE test.TestTable2 (
PK1 int,
PK2 int,
CK3 int,
CK4 int,
Dump text,
PRIMARY KEY ((PK1,PK2,CK3),CK4)
);
我想查询的转储值(PK1 = 1和Pk2 = 2和(4,5)中的Ck3 = 5和CK4)或((4,5)中的PK1 = 2和Pk2 = 2以及Ck3 = 5和CK4)
。
我无法使用或调节,有人可以建议我该如何在 CQL
推荐答案
不支持 OR
运算符:您要做的是命中2个分区,因此必须由两个不同的查询来完成。
There is no support for OR
operator: what you'd like to do is hit 2 partitions so it must be done by two different queries.
Query 1: (PK1=1 and Pk2 =2 and Ck3 =5 and CK4 in (4,5))
Query 2: (PK1=2 and Pk2 =2 and Ck3 =5 and CK4 in (4,5))
您可以自己实现短路:首先执行您希望有更大可能性检索结果的查询-如果得到结果,则停止过程,如果不执行第二条查询。
You can implement the "short circuit" by yourself: perform at first the query you'd expect to have bigger possibilities to retrieve the result -- If you got the result stop your process, if not perform second query.
这篇关于Cassandra-CQL OR运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文