Reputation: 8088
I have created a Cassandra keyspace tracker:
CREATE KEYSPACE tracker WITH replication = {
'class': 'SimpleStrategy',
'replication_factor': '3'
};
And then I can create a table in this keyspace successfully:
cqlsh:tracker> CREATE TABLE tracker.click_windows (
... visitor_id text,
... created_at timeuuid,
... click_id text,
... ended_at timeuuid,
... expires_at timeuuid,
... processed_at timeuuid,
... window_size int,
... PRIMARY KEY (visitor_id, created_at)
... ) WITH CLUSTERING ORDER BY (created_at DESC) AND
... bloom_filter_fp_chance=0.010000 AND
... caching='KEYS_ONLY' AND
... comment='' AND
... dclocal_read_repair_chance=0.000000 AND
... gc_grace_seconds=864000 AND
... read_repair_chance=0.100000 AND
... replicate_on_write='true' AND
... populate_io_cache_on_flush='false' AND
... compaction={'class': 'SizeTieredCompactionStrategy'} AND
... compression={'sstable_compression': 'SnappyCompressor'};
But when I go to add the next table/column family I get an error:
cqlsh> CREATE TABLE tracker.clicks (
... id text PRIMARY KEY,
... created_at timeuuid,
... data map
... ) WITH
... bloom_filter_fp_chance=0.010000 AND
... caching='ALL' AND
... comment='' AND
... dclocal_read_repair_chance=0.000000 AND
... gc_grace_seconds=864000 AND
... read_repair_chance=0.100000 AND
... replicate_on_write='true' AND
... populate_io_cache_on_flush='false' AND
... compaction={'class': 'SizeTieredCompactionStrategy'} AND
... compression={'sstable_compression': 'SnappyCompressor'};
Bad Request: line 5:0 mismatched input ')' expecting '<'
I found some indication that this could be a CQL version problem, but when I start cqlsh with --cql3
this still occurs. I don't see anything obvious about these two that are so different that one works and the other doesn't. I also have additional ones not working, like
cqlsh> CREATE TABLE tracker.session_hits (
... session_id timeuuid,
... hit_id timeuuid,
... click_id text,
... created_at timeuuid,
... data map,
... visitor_id text,
... window_ids list,
... PRIMARY KEY (session_id, hit_id)
... ) WITH CLUSTERING ORDER BY (hit_id DESC) AND
... bloom_filter_fp_chance=0.010000 AND
... caching='KEYS_ONLY' AND
... comment='' AND
... dclocal_read_repair_chance=0.000000 AND
... gc_grace_seconds=864000 AND
... read_repair_chance=0.100000 AND
... replicate_on_write='true' AND
... populate_io_cache_on_flush='false' AND
... compaction={'class': 'SizeTieredCompactionStrategy'} AND
... compression={'sstable_compression': 'SnappyCompressor'};
Bad Request: line 8:17 mismatched input ',' expecting '<'
Suggestions?
Upvotes: 2
Views: 3700
Reputation: 3374
You have to parametrize your collections' (map/list) definitions
http://cassandra.apache.org/doc/cql3/CQL.html#types
<collection-type> ::= list '<' <native-type> '>'
| set '<' <native-type> '>'
| map '<' <native-type> ',' <native-type> '>'
Upvotes: 7