Skip to content

Use a plugin

Plugins are plain JARs. The engine finds them on its classpath, so using a plugin means getting its JAR onto that classpath.

Add the plugin as a dependency (see each plugin page for the snippet). core-udf comes with it.

Give the JARs to spark-submit:

Terminal window
spark-submit \
--jars core-udf-1.0.0.jar,addition-udf-1.0.0.jar \
--class <your main class> your-app.jar

or let Spark download them from Maven Central:

Terminal window
spark-submit \
--packages com.camelioflux.plugins.udf:addition-udf:1.0.0 \
--class <your main class> your-app.jar
SELECT ADD(array(1, 2, 3));

A result of 6.0 means the function was found and registered. An error saying the function cannot be resolved means the JAR was not on the classpath.