CQL: Bad Request: Missing CLUSTERING ORDER for column
Asked Answered
M

1

9

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

Minier answered 20/4, 2014 at 17:15 Comment(0)
A
9

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.

Albania answered 20/4, 2014 at 20:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.