2014-04-20 15 views
6

vấn đề với truy vấn CQL nàyCQL: Bad Request: Thiếu Clustering TRÌNH TỰ cho cột

cqlsh> create table citybizz.notifications(
    ...  userId varchar, 
    ...  notifId UUID, 
    ...  notification varchar, 
    ...  time bigint,read boolean, 
    ...  primary key (userId, notifId,time) 
    ...) with clustering order by (time desc); 

Nó ném Bad Request: Missing CLUSTERING ORDER for column notifid là gì. Tôi đang sử dụng cassandra 1.2.2

Trả lời

8

Bạn cần phải xác định thứ tự cho notifId quá:

create table citybizz.notifications(
    userId varchar, 
    notifId UUID, 
    notification varchar, 
    time bigint,read boolean, 
    primary key (userId, notifId,time) 
) with clustering order by (notifId asc, time desc); 

Cassandra không chịu tự mặc định (asc) cho các phím phân nhóm khác, do đó bạn cần phải xác định nó.

Các vấn đề liên quan