我有以下卡桑德拉表结构:卡桑德拉Murmur3Partitioner行顺序
CREATE TABLE example.posts (
name text,
post_topic text,
post_date timeuuid,
post_text text,
PRIMARY KEY (name, post_topic, post_date)
) WITH CLUSTERING ORDER BY (post_topic ASC, post_date ASC)
我的分区键是name
和集群的关键是post_topic, post_date
。
我需要遍历表中的所有元素,所以我执行查询SELECT * FROM posts
并返回数据如下。
name | post_topic | post_date | post_text
tom | cassandra | 86feab80-710d-11e7-898a-176eb9e01b3a | hi
tom | cassandra | 8a4dd680-710d-11e7-898a-176eb9e01b3a | bye
john | cassandra | 930ee570-710d-11e7-898a-176eb9e01b3a | whats up
我正在使用Murmur3Partitioner。
如果我通过在表中,当我这样做处理它们在代码中一个name
的时间,我可以依靠的所有行对同一name
未来一前一后的所有元素要循环(如tom, tom, john
,而不是tom, john, tom
?
根据卡桑德拉文档It is important to understand that the order in which partitioned rows are returned, depends on the order of the hashed token values and not on the key values themselves.
如果我有产生同理2个分区键,然后将我可能得到行的混了不同的名字呢?也就是说,如果汤姆和约翰所产生的同令牌会回到tom, tom, john
或者它可能会混合起来,如tom, john, tom
。