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.
In a Java or Spring Boot application
Section titled “In a Java or Spring Boot application”Add the plugin as a dependency (see each plugin page for the snippet). core-udf comes with it.
On a Spark cluster
Section titled “On a Spark cluster”Give the JARs to spark-submit:
spark-submit \ --jars core-udf-1.0.0.jar,addition-udf-1.0.0.jar \ --class <your main class> your-app.jaror let Spark download them from Maven Central:
spark-submit \ --packages com.camelioflux.plugins.udf:addition-udf:1.0.0 \ --class <your main class> your-app.jarCheck that it loaded
Section titled “Check that it loaded”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.
