[
https://issues.apache.org/jira/browse/CASSANDRA-13130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15874258#comment-15874258
]
Benjamin Lerer commented on CASSANDRA-13130:
--------------------------------------------
bq. 1) Are there any plans to make the behaviour more intuitive like "the
second value will win because it comes last"?
Not for the moment. Feel free to open an improvement ticket if you want to (but
make sure that you have looked at my answer to question 3))
bq. How the following query will work (does an order matter?)?
I had to fix the behavior for this type of queries as part of this ticket patch.
As long as the 2 operations do not affect the same column, the results should
be the same as if they were done in 2 separate statements.
If they affect the same column then the data will be reconciled using the rules
that I previously mentioned .
For examples you can look
[here|https://github.com/blerer/cassandra/blob/13130-3.0/test/unit/org/apache/cassandra/cql3/validation/entities/CollectionsTest.java#L911].
bq. 3) Is there a general recommendation not to combine several updates to one
column in the single query?
Our recommendation is: *Do not do it*.
The output is difficult to predict and it is inefficient from the performance
point of view.
Even if the output was predictable, the update would require unecessary
transfert of data between the client and the server and unecessary computing.
Due to that our advise would still be: *Do not do it* :-)
> Strange result of several list updates in a single request
> ----------------------------------------------------------
>
> Key: CASSANDRA-13130
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13130
> Project: Cassandra
> Issue Type: Bug
> Reporter: Mikhail Krupitskiy
> Assignee: Benjamin Lerer
> Priority: Trivial
>
> Let's assume that we have a row with the 'listColumn' column and value
> \{1,2,3,4\}.
> For me it looks logical to expect that the following two pieces of code will
> ends up with the same result but it isn't so.
> Code1:
> {code}
> UPDATE t SET listColumn[2] = 7, listColumn[2] = 8 WHERE id = 1;
> {code}
> Expected result: listColumn=\{1,2,8,4\}
> Actual result: listColumn=\{1,2,7,8,4\}
> Code2:
> {code}
> UPDATE t SET listColumn[2] = 7 WHERE id = 1;
> UPDATE t SET listColumn[2] = 8 WHERE id = 1;
> {code}
> Expected result: listColumn=\{1,2,8,4\}
> Actual result: listColumn=\{1,2,8,4\}
> So the question is why Code1 and Code2 give different results?
> Looks like Code1 should give the same result as Code2.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)