Details
-
New Feature
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
None
Description
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 of:
CREATE FUNCTION sum (a bigint, b bigint) bigint AS { return a + b; }
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 however.
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.
Attachments
Attachments
Issue Links
- blocks
-
CASSANDRA-7874 Validate functionality of different JSR-223 providers in UDFs
- Resolved
- is depended upon by
-
CASSANDRA-7737 Update CQL doc for UDF
- Resolved
-
CASSANDRA-7556 Update cqlsh for UDFs
- Resolved
- is related to
-
CASSANDRA-7740 Parsing of UDF body is broken
- Resolved
-
CASSANDRA-7562 Java source code for UDFs
- Resolved
- relates to
-
CASSANDRA-7395 Support for pure user-defined functions (UDF)
- Resolved
- links to