Recompiling 32bit UDX for C++

Deployment options: Netezza Performance Server for Cloud Pak for Data System

Learn how to recompile the code and reregister UDX for C ++ on Netezza Performance Server.

Before you begin

  1. Ensure that you have the source code of the UDX.
  2. The nzudxcompile utility and the command to recompile the UDX.
  3. The registration command.

Procedure

  1. Run the nzudxcompile utility to compile the UDX source code:
    nzudxcompile UDX_One.cpp -o UDX_One.o
    Example:
    $ nzudxcompile UDX_One.cpp -o UDX_One.o
    Done
    The command compiles the source code and creates a HOST object file that is named UDX_One.o_x86, and a SPU object file that is named UDX_One.o_spu10.
  2. Register UDX.
    To complete the step, you need a return type, argument or arguments that were passed and their type, language, parameters style, etc. of the UDX.
    DB_TEST.ADMIN(ADMIN)=> create or replace function one ()
    DB_TEST.ADMIN(ADMIN)-> returns int4
    DB_TEST.ADMIN(ADMIN)-> language cpp
    DB_TEST.ADMIN(ADMIN)-> parameter style npsgeneric
    DB_TEST.ADMIN(ADMIN)-> called on null input
    DB_TEST.ADMIN(ADMIN)-> not deterministic
    DB_TEST.ADMIN(ADMIN)-> EXTERNAL CLASS NAME 'One'
    DB_TEST.ADMIN(ADMIN)-> EXTERNAL HOST OBJECT '/tmp/UDX_One.o_x86'
    DB_TEST.ADMIN(ADMIN)-> EXTERNAL SPU OBJECT '/tmp/UDX_One.o_spu10';
    CREATE FUNCTION
  3. Test the UDX:
    DB_TEST.ADMIN(ADMIN)=> select One();
     ONE
    ----
    1
     (1 row)
    
    DB1.ADMIN(ADMIN)=> select one() from tab_test;
     ONE
    ----
    1
     (1 row)