Compile the UDA

After you create and debug your C++ file for your new UDA, you need to compile the C++ file. The compilation process creates the object files that run on the host and on the Netezza Performance Server SPUs.

  • To compile the PenMax C++ file and create the API version 2 object files:
       nzudxcompile penmax.cpp
The nzudxcompile command creates the following object files:
penmax.o_x86
The object file for the Netezza Performance Server host (i386 Linux® platform on x86).
penmax.o_spu10
The object file for the Linux-based Rev10 SPUs on IBM® Netezza® 1000 and Netezza 100 models.

After you create the compiled object files, you must register the UDA with the Netezza Performance Server system so that query writers can include the UDA in their queries.

Optionally, you can also compile and register the UDA in one step by using the nzudxcompile command. This example also shows that you must include the --version 2 syntax when you are using the command to compile and register an API version 2 UDA.

To compile the PenMax C++ file and also register it in a sample database called mydb:
   nzudxcompile /home/nz/udx_files/PenMax.cpp –o PenMax.o 
–-sig "PenMax(int4)" --version 2 –-return INT4 –-class CPenMax 
--state "(int4, int4)" –-user myuser –-pw password –-db mydb

For systems running 7.0.3 or later that support multiple schemas in a database, you can specify the schema where you want to register the UDA using the --schema option, as follows:

nzudxcompile /home/nz/udx_files/PenMax.cpp –o PenMax.o
–-sig "PenMax(int4)" --version 2 –-return INT4 –-class CPenMax
--state "(int4, int4)" –-user myuser –-pw password –-db mydb --schema
myschema