You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Robert Stupp (JIRA)" <ji...@apache.org> on 2014/06/23 00:16:25 UTC

[jira] [Comment Edited] (CASSANDRA-7395) Support for pure user-defined functions (UDF)

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

Robert Stupp edited comment on CASSANDRA-7395 at 6/22/14 10:15 PM:
-------------------------------------------------------------------

Attached is some code for UDF functions.
Very simple - dirty code...
Just intended as input for the concept discussion

Concept for this POC hack was:
* Functions are grouped into bundles (which are jar files)
* Bundles are replicated in separate KS
* new {{UDFRegistry}} hooked into {{Functions}}
* bundles are managed by user tool "udfloader"

Idea:
* Use some namespace handling for functions - e.g. something like {{SELECT Math.sin(column) FROM ...}} would require the Math bundle
* Other people can write a more sophisticated bundle - e.g. a StrictMath bundle

Short instructions for this patch:
# Build C*
# Execute {{ant}}  in directory {{udf-demo}}
# Start C*
# Load UDF bundle using {{tools/bin/udfloader -b demo -f udf-demo/build/udf-demo.jar}}
# Exec cqlsh: {noformat}
cqlsh> create keyspace foo WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 2 };
cqlsh> create table foo.demo (id int primary key, num double);
cqlsh> insert into foo.demo values (1,1);
cqlsh> select id, num, Sin(num) from foo.demo;

 id | num | Sin_num
----+-----+---------
  1 |   1 | 0.84147

(1 rows)
{noformat}



was (Author: snazy):
Attached is some code for UDF functions.
Very simple - dirty code...
Just intended as input for the concept discussion

Concept for this POC hack was:
* Functions are grouped into bundles (which are jar files)
* Bundles are replicated in separate KS
* new {{UDFRegistry}} hooked into {{Functions}}
* bundles are managed by user tool "udfloader"

Idea:
* Use some namespace handling for functions - e.g. something like {{SELECT Math.sin(column) FROM ...}} would require the Math bundle
* Other people can write a more sophisticated bundle - e.g. a StrictMath bundle

Short instructions for this patch:
1. Build C*
1. Execute {{ant}}  in directory {{udf-demo}}
1. Start C*
1. Load UDF bundle using {{tools/bin/udfloader -b demo -f udf-demo/build/udf-demo.jar}}
1. Exec cqlsh: {noformat}
cqlsh> create keyspace foo WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 2 };
cqlsh> create table foo.demo (id int primary key, num double);
cqlsh> insert into foo.demo values (1,1);
cqlsh> select id, num, Sin(num) from foo.demo;

 id | num | Sin_num
----+-----+---------
  1 |   1 | 0.84147

(1 rows)
{noformat}


> 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
>             Fix For: 3.0
>
>         Attachments: 7395.diff
>
>
> 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)