You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Benjamin Lerer (JIRA)" <ji...@apache.org> on 2016/09/20 13:42:20 UTC

[jira] [Commented] (CASSANDRA-11935) Add support for arithmetic operators

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

Benjamin Lerer commented on CASSANDRA-11935:
--------------------------------------------

|[11953-trunk|https://github.com/apache/cassandra/compare/trunk...blerer:11935-trunk]|[utests|http://cassci.datastax.com/view/Dev/view/blerer/job/blerer-11935-trunk-testall/]|[dtests|http://cassci.datastax.com/view/Dev/view/blerer/job/blerer-11935-trunk-dtest/]|

The patch add support for operators and parenthesis. It also fix the way terms are used in the selection clause to allow functions on columns nested within terms. In order to do that part of the parser logic had to be rewritten as:
# a column name between parenthesis conflit with single element tuple
# a UDT can conflict with a Map 
# a type hint can conflict with an element between parenthesis

To determine which function should be used when one of the operands is a litteral the patch adds the ability to narrow the numeric types.

The returned type of the operation is determined from the types of the operands (for example: int + bigint = bigint and float + bigint = double)

> 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)