此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 最佳答案
您还需要指定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),因此您需要指定它。