Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4F835200B89 for ; Wed, 21 Sep 2016 15:25:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4E4AA160AE2; Wed, 21 Sep 2016 13:25:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9AE0D160ACF for ; Wed, 21 Sep 2016 15:25:21 +0200 (CEST) Received: (qmail 802 invoked by uid 500); 21 Sep 2016 13:25:20 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 749 invoked by uid 99); 21 Sep 2016 13:25:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Sep 2016 13:25:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 7BC702C2A64 for ; Wed, 21 Sep 2016 13:25:20 +0000 (UTC) Date: Wed, 21 Sep 2016 13:25:20 +0000 (UTC) From: "Alex Petrov (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CASSANDRA-12232) Add +=/-= shortcut syntax MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 21 Sep 2016 13:25:22 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-12232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15509894#comment-15509894 ] Alex Petrov edited comment on CASSANDRA-12232 at 9/21/16 1:24 PM: ------------------------------------------------------------------ As a bonus, we're getting shortcut syntax for counters as well "for free". I've covered this path with tests as well. |[trunk|https://github.com/ifesdjeen/cassandra/tree/12232-trunk] |[utest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-12232-trunk-testall/] |[dtest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-12232-trunk-dtest/] | was (Author: ifesdjeen): As a bonus, we're getting shortcut syntax for counters as well "for free". I've covered this path with tests as well. |[trunk|https://github.com/ifesdjeen/cassandra/tree/12232-trunk] |[utest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-12232-trunk-testall/] |[dtest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-12232-trunk-dtest/] | ] > 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 > > 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)