To compile and deploy user-defined functions
Note: The folder for UDF library deployment is set in the system property -Dpresto.raql.udf.libsDir. This may be a different folder in clustered environments with a shared external configuration folder for MashZone NextGen.
This new folder is the root deployment folder for your library. For example:
/SoftwareAG/MashZoneNG/raql-udfs/MyOrgRaqlLib
Note: You may also want to place a copy of this configuration in your library development folder to track in your source control system.
This file uses the JSON format to identify packages that contain user-defined functions for a library. For example:
{
"exportedFuncs" : {
"annotatedPackages" : [
"com.jackbe.jbp.raql.samplelib.annotated.udf",
"com.jackbe.jbp.raql.samplelib.annotated.uda",
"com.jackbe.jbp.raql.samplelib.annotated.udw"
],
"classes" : [
{
"name" : "com.jackbe.jbp.raql.samplelib.configured
.MoreStringFunctions",
"funcs" : [
{ "name" : "low", "method" : "lower" },
{ "method" : "hashCode" }
]
},
{
"name" : "com.jackbe.jbp.raql.samplelib.configured.
AverageAggregationFunctionFactory",
"funcs" : [
{ "name" : "avg" }
]
},
{
"name" : "com.jackbe.jbp.raql.samplelib.configured.
LeadWindowFunction",
"funcs" : [
{ "name" : "lead" }
]
}
]
}
}
This example identifies three packages for this library. The classes property must be present in configuration, but can be an empty array. The RAQL Engine will search each class within the identified packages for function annotations to find the functions to add.
You can also optionally identify classes, functions and methods in this configuration. See UDF Library Configuration for more information on this method.
For Windows for example:
%JAVA_HOME%/bin/javac -classpath c:\SoftwareAG\MashZoneNG\apache-tomcat\webapps\mashzone\WEB-INF\lib\jackbe-presto-raql-10.3.jar;c:\SoftwareAG\MashZoneNG\apache-tomcat\webapps\mashzone\WEB-INF\lib\rtm-core-10.3.jar -d classes src\com\MyOrg\raqlUdf\MyReplaceFunc.java
For Linux, OS/X or UNIX for example:
javac -classpath /SoftwareAG/MashZoneNG/apache-tomcat/webapps/mashzone/WEB-INF/lib/jackbe-presto-raql-10.3.jar,/SoftwareAG/MashZoneNG/apache-tomcat/webapps/mashzone/WEB-INF/lib/rtm-core-10.3.jar -d classes src/com/MyOrg/raqlUdf/MyStringFuncs.java
/classes folder and all contents
/lib folder and all contents
Important: If you have included either the RAQL or RTM JAR files in your library-name /lib folder, do not copy these JARs to the deployment folder for your library as this causes errors when functions in the library are used.