2014-04-20 5 views
6

Was das Problem mit dieser CQL Abfrage istCQL: Bad Request: Fehlende CLUSTERING ORDER für Spalte

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

Es wirft Bad Request: Missing CLUSTERING ORDER for column notifid. Ich bin mit cassandra 1.2.2

Antwort

8

Sie müssen auch den Auftrag für notifId angeben:

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 nicht Standard-Bestellung (auf) für den anderen Cluster-Schlüssel übernimmt, so dass Sie es angeben müssen.

Verwandte Themen