Processing NULL Arguments
By default, UDFs follow conventional SQL rules when NULL arguments are encountered. If any UDF argument is NULL, the UDF is not invoked, and the result of the UDF is assumed to be NULL.
If you need to write a UDF that either returns NULLs or needs to process NULL argument values, you must add “nullskip=’ignore’” to the UDF definition. When set, UDFs are expected to process NULL arguments and can also return NULL values. NULLS are indicated by the NULL type in JavaScript and None in Python. Supporting NULLs in a UDF adds overhead to UDF processing and should only be enabled when necessary.
For example:
CREATE OR REPLACE FUNCTION add_js(a integer, b integer) RETURN (integer) AS LANGUAGE js source = '
if (a == null) a = 0;
if (b == null) b = 0;
return a+b;', nullskip='ignore';\g
Last modified date: 06/28/2024