cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Stupp (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-11935) Add support for arithmetic operators
Date Thu, 02 Jun 2016 09:10:59 GMT


Robert Stupp commented on CASSANDRA-11935:

Java-UDFs get compiled from generated Java source. So the cost for that is one object for
the UDF, one class plus a bunch of objects for management.
Compiling code is an expensive operation - but if you know what you want (e.g. build an "add(bigint,
varint)") it's easier to just generate the byte code since it's a fixed pattern. These generated
functions would not need any security checks or sandbox either. Just an idea - not a real
But yea, generating one "physical" function (like {{add(bigint,varint)}}) for each combination
of types for a "logical" function (like {{+}}/{{add}}) is probably too complicated. Maybe
it's easier to extend the function-resolve-mechanism and make it able to dispatch calls against
methods in a class like {{AddFunctions}} that contains all the combinations. That {{AddFunctions}}
class could be generated, as it looks easier to test it than to code every argument type combination

> Add support for arithmetic operators
> ------------------------------------
>                 Key: CASSANDRA-11935
>                 URL:
>             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

View raw message