The nzLua table function
The nzlua table function is created during the install process in the INZA database. This function allows arbitrary nzLua code to be launched inside of the Netezza appliance by an external application directly from a SQL statement. This function is very useful for developing and testing code as well as for ETL scripting.
There are several examples of using the nzlua table function in the
/nz/extensions/nz/nzlua/examples/MapReduce directory of the
nzlua distribution. There is also the
/nz/extensions/nz/nzlua/examples/elt.sql script, which uses the
nzlua table function in combination with the Netezza SPUPad
to
perform some basic ELT processing.
select *
from table(inza..nzlua('
function processRow(x)
t={}
for i=1,x do
t[i] = { i, i*i }
end
return t
end
function getShape()
columns={}
columns[1] = { "x", integer }
columns[2] = { "x_squared", integer }
return columns
end',
11));