此CQL查询有什么问题
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);
抛出Bad Request: Missing CLUSTERING ORDER for column notifid
。我正在使用cassandra 1.2.2
答案 0 :(得分:8)
您还需要指定notifId的顺序:
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并不假设其他群集密钥的默认排序(asc),因此您需要指定它。