[ 
https://issues.apache.org/jira/browse/CASSANDRA-13262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15906894#comment-15906894
 ] 

Murukesh Mohanan commented on CASSANDRA-13262:
----------------------------------------------

This is on the Python side, specifically because the results are converted to 
an OrderedDict 
([bin/cqlsh.py#L500|https://github.com/apache/cassandra/blob/trunk/bin/cqlsh.py#L500]):
{code}
self.session.row_factory = ordered_dict_factory
{code}

Dictionaries of course don't support duplicate keys. The default row_factory is 
a named tuple, which also doesn't like duplicate keys, so we have changes to 
the key names:
{code}
Row(rack=u'rack1', timeout=5000, rack_=u'rack1')
OrderedDict([(u'rack', u'rack1'), (u'timeout', 5000)])
{code}

The simple fix would be explicitly list the values corresponding to each column 
in 
[print_static_result()|https://github.com/apache/cassandra/blob/trunk/bin/cqlsh.py#L1115]:

{code}
formatted_values = [map(self.myformat_value, [row[c] for c in column_names], 
cql_types) for row in result.current_rows]
{code}

And that sort of negates the point of using an OrderedDict in the first place.

> Incorrect cqlsh results when selecting same columns multiple times
> ------------------------------------------------------------------
>
>                 Key: CASSANDRA-13262
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13262
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Stefan Podkowinski
>            Priority: Minor
>              Labels: lhf
>
> Just stumbled over this on trunk:
> {quote}
> cqlsh:test1> select a, b, c from table1;
>  a | b    | c
> ---+------+-----
>  1 |    b |   2
>  2 | null | 2.2
> (2 rows)
> cqlsh:test1> select a, a, b, c from table1;
>  a | a    | b   | c
> ---+------+-----+------
>  1 |    b |   2 | null
>  2 | null | 2.2 | null
> (2 rows)
> cqlsh:test1> select a, a, a, b, c from table1;
>  a | a    | a             | b    | c
> ---+------+---------------+------+------
>  1 |    b |           2.0 | null | null
>  2 | null | 2.20000004768 | null | null
> {quote}
> My guess is that his is on the Python side, but haven't really looked into it.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to