我有以下卡桑德拉表結構:卡桑德拉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
。