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

Benjamin Lerer commented on CASSANDRA-9198:
-------------------------------------------

My remarks on the patch:
* I still prefer the previous error messages. {{"List index 0 out of bound, 
list has size 0"}} will not makes a lot of sense if the user as never created 
any list. The fact that C* has no empty list can be confusing. In my opinion, 
we should be carefull about the error messages and not make people believe that 
you can have some empty list.
* It would be nice if you could add some similar unit tests for sets and maps.
* The standard in C* is to use ternarys operator when you have a a simple {{if 
return else return}} (even if I am not a fan of it). Nested ternary operators 
should be avoided.

Side remark: It makes full sense that you provide a patch for that issue as you 
already worked on CASSANDRA-9077. Just make sure, that if the ticket is 
assigned to somebody else, you checked with the person before that he is fine 
with you providing a patch (which I am ;-)). We never know the person might 
have started working on it or be really interested in fixing the ticket.


> Deleting from an empty list produces an error
> ---------------------------------------------
>
>                 Key: CASSANDRA-9198
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Olivier Michallat
>            Assignee: Jeff Jirsa
>            Priority: Minor
>             Fix For: 2.1.5
>
>         Attachments: 9198.txt
>
>
> While deleting an element from a list that does not contain it is a no-op, 
> deleting it from an empty list causes an error.
> This edge case is a bit inconsistent, because it makes list deletion non 
> idempotent:
> {code}
> cqlsh:test> create table foo (k int primary key, v list<int>);
> cqlsh:test> insert into foo(k,v) values (1, [1,2]);
> cqlsh:test> update foo set v = v - [1] where k = 1;
> cqlsh:test> update foo set v = v - [1] where k = 1;
> cqlsh:test> update foo set v = v - [2] where k = 1;
> cqlsh:test> update foo set v = v - [2] where k = 1;
> InvalidRequest: code=2200 [Invalid query] message="Attempted to delete an 
> element from a list which is null"
> {code}
> With speculative retries coming to the drivers, idempotency becomes more 
> important because it determines which query we might retry or not. So it 
> would be better if deleting from an empty list succeeded.



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

Reply via email to