You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2013/09/18 14:28:52 UTC

[jira] [Resolved] (CASSANDRA-6051) Wrong toString() of CQL3Type.Collection

     [ https://issues.apache.org/jira/browse/CASSANDRA-6051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne resolved CASSANDRA-6051.
-----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.10
         Assignee: Sylvain Lebresne

Fixed in commit fc9b3a7. Thanks
                
> 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
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 1.2.10
>
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> {{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