質問

What is the problem with this CQL query

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);

It throws Bad Request: Missing CLUSTERING ORDER for column notifid. I am using cassandra 1.2.2

役に立ちましたか?

解決

You need to specify the order for notifId too:

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 doesn't assume default ordering (asc) for the other clustering keys so you need to specify it.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top