cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tyler Hobbs (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-7526) Defining UDFs using scripting language directly from CQL
Date Fri, 03 Oct 2014 23:29:34 GMT


Tyler Hobbs commented on CASSANDRA-7526:

[~snazy] can you post a new branch or patch?  The current one looks like it has work from
CASSANDRA-7874 and has leftover classes (JavaSourceBasedUDF, AbstractJavaUDF.

When the return type is BigInteger, you're doing {{BigInteger.valueOf(rNumber.longVaue())}},
which could result in the value being truncated.  Why not go through {{toString()}}, like
you do with BigDecimal?

Other than that, it looks pretty good.  One nitpick is that you're using curly braces for
some single-line for-loops in ScriptBasedUDF.

I'd like to wait for CASSANDRA-4914 to get sorted out a little more before we decide to commit

> Defining UDFs using scripting language directly from CQL
> --------------------------------------------------------
>                 Key: CASSANDRA-7526
>                 URL:
>             Project: Cassandra
>          Issue Type: New Feature
>            Reporter: Sylvain Lebresne
>            Assignee: Robert Stupp
>             Fix For: 3.0
>         Attachments: 7526.txt, 7526v2.txt, 7526v3.txt, 7526v4.txt, 7526v5.txt
> In CASSANDRA-7395 we'll introduce the ability to define user functions by dropping a
java class server side. While this is a good first step and a good option to have in any case,
it would be nice to provide a simpler way to define those functions directly from CQL. And
while we probably don't want to re-invent a new programming language inside CQL, we can reuse
one. Typically, with java 8, we could use nashorn. This would allow a syntax along the lines
> {noformat}
> CREATE FUNCTION sum (a bigint, b bigint) bigint AS { return a + b; }
> {noformat}
> Note that in this, everything before the AS will be parsed by us, which we'll probably
want because we'll probably need to have the types of arguments/return in practice anyway,
and it's a good idea to reuse CQL types. The expression after the AS will be given to Nashorn
> Please note that in theory we could ultimately support multiple language after the AS.
However, I'd like to focus on supporting just one for this ticket and I'm keen on using javascript
through Nashorn because as it's the one that will ship with java from now on, it feels like
a safe default.

This message was sent by Atlassian JIRA

View raw message