1

Why is this not working:

CREATE TABLE bwlists (uuid uuid PRIMARY KEY, bwl map<ascii, bw map<ascii, ascii>>);

I got:

Bad Request: line 1:79 no viable alternative at input '>'

3
  • Not certain on this, but it seems like it should be: bwl map<ascii>, bw map<ascii, ascii> Nov 18, 2014 at 14:02
  • This also not working.
    – lubom
    Nov 18, 2014 at 14:13
  • 1
    It isn't supported in Cassandra. Nov 18, 2014 at 16:27

1 Answer 1

3
CREATE TABLE bwlists (
  uuid uuid PRIMARY KEY, 
  bwl map<ascii, bw map<ascii, ascii>>);

Bad Request: line 1:79 no viable alternative at input '>'

Your first problem, is that you are trying to name the map bw within the bwl map. That's not going to work, as CQL is not expecting to find an identifier (instead of a type). Your syntax can then be adjusted to this:

CREATE TABLE bwlists (
  uuid uuid PRIMARY KEY, 
  bwl map<ascii, map<ascii, ascii>>);

But that still doesn't work. Running this CREATE statement yields this message:

<ErrorMessage code=2000 [Syntax error in CQL query]
  message="map type cannot contain another collection">

Currently, Cassandra/CQL does not permit creating a "map of a map."

Also, it's not a good idea to use reserved words as column names, even if Cassandra lets you do it. I'd rename uuid to something more context-specific to your application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.