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

Robert Stupp commented on CASSANDRA-7395:
-----------------------------------------

Change notes:
* Adopted C* code style
* Removed {{CREATE/DROP BUNDLE}}
* Allow {{CREATE FUNCTION}} with namespace {{namespace::function}} syntax - 
UDFs without namespaces are also allowed
* {{CREATE FUNCTION}} fails if user attempts to create (non-namespace) function 
with name of an existing 'core CQL' function (e.g. {{writetime}})
* {{CREATE/CREATE OR REPLACE FUNCTION}} fails if UDF does not validate or 
compile (future stuff) - no changes are written to the system table. But if an 
invalid function is found in the system table, the function's meta data is 
loaded to be able to replace or drop it. This might occur if the UDF class is 
removed, the JSR223 provider is removed or whatever. But it's of course not 
possible to execute the function - re-validation only occurs on next DDL (or 
next node startup).
* UDF names (both namespaces and function names) are case insensitive
* change in cqlsh to allow execution of namespaced functions
* added some TODO in code for follow-up tickets
* removed javassist stuff
* separated UDF meta data (class {{UFMetaData}}) and executable support (class 
{{UDFunction}}). 2nd one to be changed/extended by Java source and JSR223 
follow-ups.
* verified availability of UDFs in whole cluster (local 3 node ccm cluster)
* 'core CQL' functions are preferred over UDFs at execution
* only 'primitive' CQL types are supported (follow-up ticket exists)
* adopted suggested PK change
* Syntax for Java class names is {{fully-qualified-class-name ( '#' method-name 
)?}} - if the method name is missing, the function name is used as the method 
name
* Java classes must be {{public}} - methods must be {{public static}}
* Parameters must be the boxed variants (e.g. {{Integer}} - NOT {{int}}) - 
required to be able to handle {{null}}. Same for return types.

Note:
Application level conflicts may arise if new 'core CQL' functions appear in a 
future C* version with the same name of existing UDFs. We should make that 
clear in documentation and encourage users to use namespaces. The only 
alternative that came to my mind was to force users to use {{SELECT 
::sin(foo)...}} for non-namespace UDFs - but I'm not happy with that 
alternative.

I'd be glad to get some feedback :)

> Support for pure user-defined functions (UDF)
> ---------------------------------------------
>
>                 Key: CASSANDRA-7395
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7395
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: API, Core
>            Reporter: Jonathan Ellis
>            Assignee: Robert Stupp
>              Labels: cql
>             Fix For: 3.0
>
>         Attachments: 7395.txt, udf-create-syntax.png, udf-drop-syntax.png
>
>
> We have some tickets for various aspects of UDF (CASSANDRA-4914, 
> CASSANDRA-5970, CASSANDRA-4998) but they all suffer from various degrees of 
> ocean-boiling.
> Let's start with something simple: allowing pure user-defined functions in 
> the SELECT clause of a CQL query.  That's it.
> By "pure" I mean, must depend only on the input parameters.  No side effects. 
>  No exposure to C* internals.  Column values in, result out.  
> http://en.wikipedia.org/wiki/Pure_function



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to