Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top