You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Tyler Hobbs (JIRA)" <ji...@apache.org> on 2015/02/04 00:06:34 UTC

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

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

Tyler Hobbs updated CASSANDRA-8733:
-----------------------------------
    Attachment: 8733-2.0.txt

The attached patch fixes prepend ordering.  We had dtests to cover this, but apparently they were incorrect; I have a [dtest branch|https://github.com/thobbs/cassandra-dtest/tree/CASSANDRA-8733] to fix that.

Obviously the fix is simple.  The only thing that concerns me is whether somebody was depending on the existing behavior.  However, I imagine that if anybody used this, they would have opened a ticket.  [~slebresne] what do you think about fixing this in 2.0?

> 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)