Workspace file
The Workspace file channel is the default when Netezza is accessed from an R client. The
data file is created automatically when R AE is invoked using one of the nzLibrary
for R functions. This channel is therefore not designed for manual access.
Note: The R client can be run in many locations, including Netezza itself. The only requirement is
ODBC access to the Netezza server. Regardless of where the client is running, user code is
transferred via RODBC and put in the workspace directory in the same way.
In this channel, the file name is stored in the
WORKSPACE_PATH environment
variable. The file itself should be located in the workspace folder, which for the R Language
Adapter is $ {NZ_EXPORT_DIR}/ae/workspace/nz/r_ae. This file must contain a
serialized list with the following elements:- Required:
mode,fun,args. - Optional:
shaper,shaper.args,columns,shaper.list,file.
To create a file, you might invoke the following in R, which assumes that
NZ_EXPORT_DIR is equal to
/nz/export):x <- list(mode='run', args=list(), fun=function(){
getNext(); setOutput(0,'output value'); outputResult()})
output <- file('/nz/export/ae/workspace/nz/r_ae/raedata','w')
serialize(x, output, ascii=TRUE)
close(output)To invoke the function, run the following SQL
query:
SELECT * FROM TABLE WITH FINAL(nzr..r_udtf('WORKSPACE_PATH=raedata'));which
results in:COLUMNID | VALUE
----------+--------------
0 | output value
(1 row)