Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CQL: Bad Request: Missing CLUSTERING ORDER for column

Tags:

cassandra

cql3

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

like image 356
Manish Kumar Avatar asked Apr 20 '14 17:04

Manish Kumar


1 Answers

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.

like image 149
Richard Avatar answered Nov 17 '22 21:11

Richard