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

Alex Petrov edited comment on CASSANDRA-13197 at 4/4/17 7:43 AM:
-----------------------------------------------------------------

Attaching the patch. To elaborate and my previous comment a little bit: the 
current error message in prepared statement / placeholder variables case when 
map is given instead of actually makes sense: {{Unexpected extraneous bytes 
after set value}}. Moreover, this is a good place to resolve it. We could make 
a distinction between Discarder for Maps and Sets, which would allow us to make 
more specific error messages, but at the moment I do not think that this is 
necessary.

[dtest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-13197-3.11-dtest/]|
|[trunk|https://github.com/ifesdjeen/cassandra/tree/13197-trunk]|[utest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-13197-trunk-testall/]|[dtest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-13197-trunk-dtest/]|



was (Author: ifesdjeen):
Attaching the patch. To elaborate and my previous comment a little bit: the 
current error message in prepared statement / placeholder variables case when 
map is given instead of actually makes sense: {{Unexpected extraneous bytes 
after set value}}. Moreover, this is a good place to resolve it. We could make 
a distinction between Discarder for Maps and Sets, which would allow us to make 
more specific error messages, but at the moment I do not think that this is 
necessary.

|[3.11|https://github.com/ifesdjeen/cassandra/tree/13197-3.11]|[utest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-13197-3.11-testall/]|[dtest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-13197-3.11-dtest/]|
|[trunk|https://github.com/ifesdjeen/cassandra/tree/13197-trunk]|[utest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-13197-trunk-testall/]|[dtest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-13197-trunk-dtest/]|


> +=/-= shortcut syntax bugs/inconsistencies
> ------------------------------------------
>
>                 Key: CASSANDRA-13197
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13197
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Kishan Karunaratne
>            Assignee: Alex Petrov
>
> CASSANDRA-12232 introduced (+=/-=) shortcuts for counters and collection 
> types. I ran into some bugs/consistencies.
> Given the schema:
> {noformat}
> CREATE TABLE simplex.collection_table (k int PRIMARY KEY, d_l List<int>, d_s 
> Set<int>, d_m Map<int,int>, d_t Tuple<int>);
> {noformat}
> 1) Using -= on a list column removes all elements that match the value, 
> instead of the first or last occurrence of it. Is this expected?
> {noformat}
> Given d_l = [0, 1, 2, 1, 1]
> UPDATE collection_table SET d_l -= [1] WHERE k=0;
> yields 
> [0, 2]
> {noformat}
> 2) I can't seem to remove a map key/value pair:
> {noformat}
> Given d_m = {0: 0, 1: 1}
> UPDATE collection_table SET d_m -= {1:1} WHERE k=0;
> yields
> Invalid map literal for d_m of type frozen<set<int>>
> {noformat}
> However {noformat}UPDATE collection_table SET d_m -= {1} WHERE k=0;{noformat} 
> does work.
> 3) Tuples are immutable so it make sense that +=/-= doesn't apply. However 
> the error message could be better, now that other collection types are 
> allowed:
> {noformat}
> UPDATE collection_table SET d_t += (1) WHERE k=0;
> yields
> Invalid operation (d_t = d_t + (1)) for non counter column d_t
> {noformat}



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

Reply via email to