Starting from 11.2.0.0, Netezza Performance Server
has a 64-bit architecture. After upgrading to 11.2.0.0, you must recompile all UDXs.
Object files created with nz_ddl_function do not work on the 64-bit code. The
UDX source code has to be re-compiled on 64-bit system. You must create new object files by using
nzudxcompile. INZA and SQL Extention Toolkit have to be reinstalled with the
corresponding 11.2.0.0 packages.
Before you begin
- Ensure that you have the source code of the UDX, the nzudxcompile utility and
the command to recompile the UDX, and the registration command.
- Run the following
commands:
nzudxcompile --getSpuArch
nzudxcompile --getHostArch
Both
of the commands must return 64
. Example:
$ nzudxcompile --getSpuArch
64
$ nzudxcompile --getHostArch
64
The nzudxcompile utility that you are going to use is from the 64-bit Netezza Performance Server package (version 11.2.0.0 or higher).
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
.
- 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
- 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)