Search code examples
cassandracqlsh

Unable to create nested collection datatype


I am not able to create collection inside another collection in Cassandra. Please find error details below

cqlsh:TestKeyspace> create table users2(user_id text primary key, feeschedule map<text,set<text>>);
Bad Request: map type cannot contain another collection

Here I am trying to create column named feeschedule with type Map and Map have values which is of type List.

Could anybody suggest me how do I achieve it in Cassandra. My Cassandra version details are given below:

cqlsh version- cqlsh 4.1.0
Cassandra version – 2.0.2

Thanks in advance,


Solution

  • You are correct, nested collections are not supported.

    You will be able to do something similar with user-defined types, but not until 2.1: https://issues.apache.org/jira/browse/CASSANDRA-5590