Alexander Radzin created CASSANDRA-6051: -------------------------------------------
Summary: Wrong toString() of CQL3Type.Collection Key: CASSANDRA-6051 URL: https://issues.apache.org/jira/browse/CASSANDRA-6051 Project: Cassandra Issue Type: Bug Components: Core Reporter: Alexander Radzin Priority: Minor {{Collection}} is an inner class of {{CQL3Type}} that represents column types that can contain several values (lists, sets, maps). Its {{toString()}} is very helpful: it generates a string representation of type that can be used for generating of {{CREATE TABLE}} statement. Unfortunately this method works incorrectly for maps. Instead of returning something like {{map<text, int>}} it returns {{set<text, int>}}. Here is the appropriate code fragment: {code:title=CQL3Type$Collection.java|borderStyle=solid} public String toString() { switch (type.kind) { case LIST: return "list<" + ((ListType)type).elements.asCQL3Type() + ">"; case SET: return "set<" + ((SetType)type).elements.asCQL3Type() + ">"; case MAP: MapType mt = (MapType)type; return "set<" + mt.keys.asCQL3Type() + ", " + mt.values.asCQL3Type() + ">"; } throw new AssertionError(); } {code} The obvious bug is here: {code:java} case MAP: MapType mt = (MapType)type; return "set<" + mt.keys.asCQL3Type() + ", " + {code} It should be {{"map<" + ...}} instead of {{"set<" + ...}} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira