Manually Adding Custom Functions to Drill
Administrators can manually add custom functions to Drill. After the custom function is developed, generate the sources and classes JAR files. Add both JAR files to the Drill classpath on each node, and include the name of the package that contains the classes to the main Drill configuration file. Restart the drillbit on each node to refresh the configuration.
To add a custom function to Drill, complete the following steps:
- Add the sources and classes JAR file for the custom function to the Drill classpath on all drillbits by copying the files to
<drill installation directory>/jars/3rdparty. - Include a
drill-module.conffile in the class JAR file, at its root. -
Add the following code to
drill-module.conf(src/main/resources/drill-module.conf), and replacecom.yourgroupidentifier.udfwith the package name(s) of your UDF(s), as shown below:drill.classpath.scanning.packages += "com.yourgroupidentifier.udf" **Note:** Separate package names with a comma. - Verify that
DRILL_HOME/conf/drill-override.confdoes not contain any information regarding UDF packages. -
Issue the following command to restart Drill:
<drill_installation_directory>/bin/drillbit.sh restartNow, you can use the custom function(s) in Drill queries.
