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 2015/02/04 15:52:35 UTC

[jira] [Commented] (CASSANDRA-8733) List prepend reverses item order

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

Sylvain Lebresne commented on CASSANDRA-8733:
---------------------------------------------

+1, for both the patch and for 2.0: it's obviously a bug (no prepend method in the history of computing science has ever done this on purpose).

> List prepend reverses item order
> --------------------------------
>
>                 Key: CASSANDRA-8733
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8733
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Tyler Hobbs
>            Assignee: Tyler Hobbs
>             Fix For: 2.1.3, 2.0.13
>
>         Attachments: 8733-2.0.txt
>
>
> If you prepend a list of items to a list collection, it will reverse the order of the prepend-list:
> {noformat}
> cqlsh:ks1> UPDATE foobar SET b = [2, 3] WHERE a = 0;
> cqlsh:ks1> select * from foobar;
>  a | b
> ---+--------
>  0 | [2, 3]
> (1 rows)
> cqlsh:ks1> UPDATE foobar SET b = [0, 1] + b WHERE a = 0;
> cqlsh:ks1> select * from foobar;
>  a | b
> ---+--------------
>  0 | [1, 0, 2, 3]
> (1 rows)
> {noformat}
> This is because we're going through the prepend-list in a normal-order for-loop and prepending each time (in Lists.Prepender).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)