confluentinc / ksql

The database purpose-built for stream processing applications.
https://ksqldb.io
Other
83 stars 1.04k forks source link

Suggestion - User Defined Functions via JSR 223 #550

Open joewood opened 6 years ago

joewood commented 6 years ago

As an alternative suggestion for UDF extensibility using JARs, KSQL could use the Cassandra approach and defined use functions in script or Java using DDL like statements. An suggested example would be:

CREATE OR REPLACE FUNCTION sliceString (column VARCHAR, start INTEGER, end? VARCHAR) 
RETURNS STRING
LANGUAGE javascript AS 
$$ column && column.slice(start,end) || null $$;

I see the advantages here as:

zacharywhitley commented 6 years ago

There has been a proposal to deprecate Nashorn http://openjdk.java.net/jeps/335 so it's not clear what it's future might me and might be picked up in GraalVM

mitch-seymour commented 5 years ago

Hi all, I've created a POC that implements scripted / multilingual UDFs here:

https://github.com/magicalpipelines/docker-ksql-multilingual-udfs-poc

I have working examples of Javascript, Python, and Ruby UDFs. The new functionality leverages GraalVM, and the actual branch I'm working on is here.

I'd love some feedback if you have time (@joewood, @dguy, @zacharywhitley, anyone else).

I'm not sure what other work is happening in this direction, but I'd love to help roll this feature if no one else is actively working on it. I'm also happy to submit a KLIP before I continue with this work.