IBM PureData System for Analytics, Version 7.1

Compile the UDF

After you create your C++ file for your new UDF, compile the C++ file by using the nzudxcompile command. The command is in the /nz/kit/bin/adm directory. The compilation process creates the object files that run on the IBM® Netezza® host and on the Netezza SPUs.

The nzudxcompile command creates the following object files:
customername.o_x86
The object file for the Netezza host (i386 Linux platform on x86).
customername.o_spu10
The object file for the Linux-based Rev10 SPUs on IBM Netezza 1000 and Netezza 100 models (formerly called Netezza TwinFin® and Skimmer® systems).

After you create the compiled object files, you must register the UDF with the Netezza system. You can register a user-defined function by using the CREATE FUNCTION command, as described in the next section.

Optionally, you can also compile and register a UDF in one step by using the nzudxcompile command. For example, to compile the customername C++ file and also register it in a sample database called mydb:
nzudxcompile customername.cpp –o customername.o
 –-sig "CustomerName(varchar(64000))" --version 2 –-return INT4
 –-class CCustomerName –-user myuser –-pw password –-db mydb

In this example, the double quotation marks are required to ensure that the shell properly handles the parentheses characters. 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 UDF. The command adds the UDF to the default schema of the mydb database. 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 UDF using the --schema option, as follows:

nzudxcompile customername.cpp –o customername.o
–-sig "CustomerName(varchar(64000))" --version 2 –-return INT4
–-class CCustomerName –-user myuser –-pw password –-db mydb
--schema my_schema


Feedback | Copyright IBM Corporation 2014 | Last updated: 2014-02-28