Search code examples
cassandracql3

With CQL3 and comparator getting EOF error on create table


I try running the following create table in cqlsh:

    CREATE TABLE measurements (metricid uuid, appid uuid, sourceid uuid, 
tagid uuid, day int, type int, PRIMARY KEY (metricid, appid, sourceid, 
tagid, day, type) WITH comparator=uuid);

I receive an error missing EOF at ')'.

As long as I do not include the WITH comparator I am fine, but I need the comparator.

I've tried a number of different combinations but can't seem to get this one correct. What am I doing wrong?

EDIT

I modified the query to work as follows:

CREATE TABLE measurements (metricid uuid, appid uuid, sourceid uuid, 
tagid uuid, day int, type int, sequence timeuuid, 
PRIMARY KEY ((metricid, appid, sourceid, tagid, day, type), sequence);

But I still would like to know what was incorrect with the first query. According to the CQL3 specs: http://www.datastax.com/docs/1.1/references/cql/CREATE_COLUMNFAMILY it should work.


Solution

  • The WITH should go outside the parentheses, just like in the examples on the page you link to. Also, comparator is not a valid CQL3 option (and you specify the types of the columns so it would be superflous anyway), just remove it.