cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CASSANDRA-6051) Wrong toString() of CQL3Type.Collection
Date Wed, 18 Sep 2013 12:28:52 GMT

     [ 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

Mime
View raw message