[
https://issues.apache.org/jira/browse/CASSANDRA-11935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15676532#comment-15676532
]
Benjamin Lerer commented on CASSANDRA-11935:
--------------------------------------------
bq. Honestly, if that's the only issue.
Unfortunatly it is not. If you have {{SELECT a + b}} where {{a}} and {{b}} are
columns of {{int}} type you will get the same error message because: {{tinyint
add(int, int)}}, {{smallint add(int, int)}}, {{int add(int, int)}}, etc... will
all match.
bq. It's not a terribly general (it might vaguely make sense for operators, but
I don't think it particuarly does for function in general) and that somewhat
conflict with the "prefered type" choice in some cases on principle.
In my patch this rule is only used for operators.
I do not think that there is a conflict with the prefered type here. The
prefered type is just a way to narrow down the set of functions. Unfortunatly,
it is not enough in this case. The only way to narrow down the set to one here
is to add an extra rule.
Taking into account the fact that the type with the highest precision will
always the one returned I do not think that it is a bad choice.
> 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)