cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Lerer (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-12232) Add +=/-= shortcut syntax
Date Mon, 26 Sep 2016 10:02:20 GMT

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

Benjamin Lerer updated CASSANDRA-12232:
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 3.10
           Status: Resolved  (was: Patch Available)

Committed into trunk at cfa90c065f649ea5fac5507cf6c06c9a3d3254de

> Add +=/-= shortcut syntax
> -------------------------
>
>                 Key: CASSANDRA-12232
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12232
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL
>            Reporter: Sylvain Lebresne
>            Assignee: Alex Petrov
>            Priority: Minor
>              Labels: doc-impacting
>             Fix For: 3.10
>
>
> For collections and counters, the current syntax to add/remove elements is:
> {noformat}
> UPDATE foo SET myCollection = myCollection + ...;
> {noformat}
> which is fine, though it's already tad annoying to have to repeat {{myCollection}}. 
> But moving forward, with tickets CASSANDRA-7826, we'll start being able to add to nested
collections and we'll end up with queries like:
> {noformat}
> UPDATE foo SET myCollection['someElement']['otherElemnt'] = myCollection['someElement']['otherElemnt']
+ ...;
> {noformat}
> where the repetition is starting to be really annoying and it makes the query less readable.
> It's trivial however to add a {{+=}}/{{-=}} shortcut syntax which would read instead:
> {noformat}
> UPDATE foo SET myCollection['someElement']['otherElemnt'] += ...;
> {noformat}
> As this would just be syntactic sugar, it only requires a few minor addition to the grammar
and this would be completely optional: if some users prefer the verbose syntax, that's fine.
> Also note that while this will be even more useful after things like CASSANDRA-7826,
it's already a nice to have today so it's not dependent on that latter ticket in any way.



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

Mime
View raw message