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

Sylvain Lebresne commented on CASSANDRA-7461:
---------------------------------------------

Do you think there is that much difference between those to justify spitting 
it? I mean, I don't mind it in principle, but I feel it'll just split the 
discussion on what feels to me like essentially the same thing, and will create 
arbitrary dependencies between the patches.

Overall, I strongly feel that operator should just be syntactic sugar native 
functions. In particular, on the grammar side, I'd let operators act between 
any 2 terms, and so supporting {{+}} on numbers or on strings will be the same 
outside of dispatching to different (trivial) methods based on the type.

The main issue I see on this ticket is that our current type system is 
necessarily up to the task, at least not if we want a good user experience, 
mainly due to the fact that we'll need multiple overload of the operator 
functions for every type (typically a {{add(int, int)}}, {{add(bigint, 
bigint)}}, ....) and that if we do that currently, things like {{add(2, 3)}} 
won't type-check because it will complain that multiple overload could apply 
(true) and that it can't make a choice. This problem is not really specific 
related to operators however, it's more about how we make functions resolution 
when there is overloads smarter (which I think we can do but I'll let that 
discussion for another comment) and if anything, it's that part that I would 
split in a separate ticket (since again, it's not specific to operators, even 
if operators are a good motivation for the improvement). 

> operator functionality in CQL
> -----------------------------
>
>                 Key: CASSANDRA-7461
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7461
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: CQL
>            Reporter: Robert Stupp
>            Assignee: Benjamin Lerer
>              Labels: cql
>
> Intention: Allow operators in CQL
> Operators could be decimal arithmetics {{+ - * /}} or boolen arithmetics {{| 
> & !}} or string 'arithmetics' {{+}}
> {{SELECT tab.label + ' = ' + tab.value FROM foo.tab}}
> {{SELECT * FROM tab WHERE tab.label + ' = ' + tab.value = 'foo = bar'}}
> as well as
> {{CREATE INDEX idx ON tab ( tab.tabel + '=' + tab.value )}}
> or
> {{CREATE INDEX idx ON tab (label) WHERE contains(tab.tabel, 
> 'very-important-key')}}
> Operators could be mapped to UDFs like this:
> {{+}} mapped to UDF {{cstarstd::oper_plus(...)}}
> {{-}} mapped to UDF {{cstarstd::oper_minus(...)}}
> or handled directly via {{Cql.g}} in 'special' code



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to