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 28214200B40 for ; Wed, 1 Jun 2016 20:20:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 26E9D160A4C; Wed, 1 Jun 2016 18:20:01 +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 744BB160A4E for ; Wed, 1 Jun 2016 20:20:00 +0200 (CEST) Received: (qmail 94455 invoked by uid 500); 1 Jun 2016 18:19:59 -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 94366 invoked by uid 99); 1 Jun 2016 18:19:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jun 2016 18:19:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 4A4C82C1F68 for ; Wed, 1 Jun 2016 18:19:59 +0000 (UTC) Date: Wed, 1 Jun 2016 18:19:59 +0000 (UTC) From: "Sylvain Lebresne (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CASSANDRA-11935) Add support for arithmetic operators MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 01 Jun 2016 18:20:01 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-11935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15310803#comment-15310803 ] Sylvain Lebresne edited comment on CASSANDRA-11935 at 6/1/16 6:19 PM: ---------------------------------------------------------------------- I don't believe in doing something for CQL because SQL does it and in particular, SQL allows pretty complicated query that we will never allow in CQL and don't want, which imply some things are less justified in CQL. We also tend to favor explicitness in C*/CQL. Also, the fact we've recently added specific *explicit* syntax for such conversion (CASSANDRA-10310) and are now saying some of it should be implicit make me worry that we're adding stuff to the type system without a good idea of the big picture. Overall, I'm not convinced that _in CQL_ there will so many case where such implicit conversion will be useful to justify adding their magic. But at the very least, I'm pretty sure we can go far enough with operators without it and so discussing their addition should be left to another ticket (besides, such implicit conversions are not really specific to operators). was (Author: slebresne): I don't believe in doing something for CQL because SQL does it and in particular, SQL allows pretty complicated query that we will never allow in CQL and don't want, which imply some things are less justified in CQL. We also tend to favor explicitness in C*/CQL. Overall, I'm not entirely that such implicit conversions and that justify some differences. We can certainly draw inspiration from SQL when it make sense, but stuffs needs to be justified *for* CQL. Among other things, we tend to favor explicitness in C*/CQL over saving a few character in typing, and I happen to think it's a good idea. Also, the fact we've recently added specific *explicit* syntax for such conversion (CASSANDRA-10310) and are now saying some of it should be implicit make me worry that we're adding stuff to the type system without a good idea of the big picture, and that worries me. Overall, I'm not convinced that _in CQL_ there will so many case where such implicit conversion will be necessary to justify adding their magic, but at the very least, I'm pretty sure we can go far enough with operators without it and so discussing their addition should be left to another ticket (besides, such implicit conversions are not really specific to operators). > Add support for arithmetic operators > ------------------------------------ > > Key: CASSANDRA-11935 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11935 > Project: Cassandra > Issue Type: Sub-task > Components: CQL > Reporter: Benjamin Lerer > Assignee: Benjamin Lerer > Fix For: 3.x > > > The goal of this ticket is to add support for arithmetic operators: > * {{-}}: Change the sign of the argument > * {{+}}: Addition operator > * {{-}}: Minus operator > * {{*}}: Multiplication operator > * {{/}}: Division operator > * {{%}}: Modulo operator > This ticket we should focus on adding operator only for numeric types to keep the scope as small as possible. Dates and string operations will be adressed in follow up tickets. > The operation precedence should be: > # {{*}}, {{/}}, {{%}} > # {{+}}, {{-}} > Some implicit data conversion should be performed when operations are performed on different types (e.g. double + int). -- This message was sent by Atlassian JIRA (v6.3.4#6332)