下面的select查詢對於我定義的columnfamily是可能的,因爲我收到了錯誤的請求錯誤。我應該如何模擬我的柱狀家族以獲得正確的結果。如何建模cassandra columnfamily
CREATE TABLE recordhistory ( userid bigint, objectid bigint, operation text, record_link_id bigint, time timestamp, username text, value map<bigint, text>, PRIMARY KEY ((userid, objectid), operation, record_link_id, time) ) WITH CLUSTERING ORDER BY (operation ASC, record_link_id ASC, time DESC)
選擇查詢:
SELECT * FROM recordhistory WHERE userid=439035 AND objectid=20011009 AND operation='update' AND time>=1389205800000 AND time<=1402338600000 ALLOW FILTERING;
錯誤的請求:PRIMARY KEY列 「時間」 不能被限制(列 「record_link_id」 前面是要麼沒有限制或由非EQ關係)
SELECT * FROM recordhistory WHERE userid=439035 AND objectid=20011009 AND record_link_id=20011063 ALLOW FILTERING;
錯誤請求:PRIMARY KEY列「record_link_id」不能被限制(前一列「操作」不是受限制的或者是非EQ關係上)
[「錯誤的請求:PRIMARY KEY部分\ _id不能被限制」當試圖選擇使用條件](http://stackoverflow.com/questions/22989708/bad-request -primary-key-part-to-id-can-be-restricted-when-trying-to-select) – fedorqui 2014-09-29 10:28:54
其實在這裏我在查詢中使用分區鍵,並試圖通過跳過一些聚簇列來使用ALLOW FILTERING。 – Aftab 2014-09-29 11:04:30