R language table function (remote mode) 1

Concepts

In R, the connection point setup is handled automatically for the user through the handleConnection() function, which is a part of the nzrserver package. The user needs to provide only the function itself, optionally with its shaper/sizer. Hence, the remote implementation does not differ from its local equivalent.

Code

For the implementation of applyop in R, use the same code that is shown in R Language Scalar Function 1.

Compilation

The compilation step is identical to the one in R Language Scalar Function 1.

Registration

Register the launcher and the function as follows:

/nz/export/ae/utilities/bin/register_ae --language r --version 3 \
     --template udtf --exe /tmp/applyop.R --sig "launch_remote_applyop(INT8)" \
     --return "TABLE(aeresult varchar(255))" --db dev --user nz \
     --remote --rname applyOpRemote --launch

/nz/export/ae/utilities/bin/register_ae --language r --version 3 \
     --template udf --exe /tmp/applyop.R --return INT4 --db dev --user nz \
     --sig "remote_applyop(VARCHAR(1), INT4, INT4)" \
     --remote --rname applyOpRemote

Running

To run the remote R AE, first launch the remote process as follows:

SELECT * FROM TABLE WITH FINAL(launch_remote_applyop(0));
                                          AERESULT
---------------------------------------------------------------------------------
-----------------
 tran: 21764 session: 16231 data slc: 0 hardware: 0 machine: netezza process:
14611 thread: 14611
(1 row)

Then start the computations as follows:

SELECT remote_applyop('*', 2, 13);
 REMOTE_APPLYOP 
----------------
            26
(1 row)

Finally, stop the remote process as follows:

SELECT * FROM TABLE WITH FINAL(inza..nzaejobcontrol('stop',0,
 'applyOpRemote',false,NULL, NULL));
                               AERESULT                                | AERC | .
. .
-----------------------------------------------------------------------+------+ .
. .
 netezza 14611 (applyOpRemote dataslc:-1 sess:-1 trans:-1) AE stopped | 0 | .
. .