Compile the UDTF

After you create your C++ file for your new UDTF, 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 will run on the Netezza Performance Server host and on the Netezza Performance Server SPUs.

  • To compile the parseNames.cpp file and create the output object files:
       nzudxcompile parseNames.cpp
The nzudxcompile command creates the following object files:
parseNames.o_x86
The object file for the Netezza® host (i386 Linux® platform on x86).
parseNames.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 UDTF with the Netezza Performance Server system. You can register a user-defined function by using the CREATE FUNCTION command.

Optionally, you can also compile and register a UDTF in one step by using the nzudxcompile command. For example, to compile the parseNames C++ file and also register it in a sample database called mydb:
nzudxcompile --sig "parseNames(VARCHAR(ANY))" --return
"TABLE(product_id VARCHAR(200))" --class parseNames --version 2
parseNames.cpp –-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 UDTF using the --schema option, as follows:

nzudxcompile --sig "parseNames(VARCHAR(ANY))" --return 
"TABLE(product_id VARCHAR(200))" --class parseNames --version 2 parseNames.cpp 
–-user myuser –-pw password –-db mydb 
--schema myschema