Was this helpful?
JavaScript UDFs
JavaScript UDFs are enabled by default, as described in How to Set up User-defined Functions in the System Administrator Guide.
Using Imports
All imports must be placed at the top of the UDF source and must contain an absolute path to the import file:
import “/my/full/path/source.js”
The imported JS file must include at least one exported function:
export function foo(arg1) { … }
With secured UDFs, the path must always be /opt/Actian/vectorwise-udf/import. You can map this directory to a location available on the container’s host. For example:
create or replace function md5(a varchar(100)) return (varchar(100)) as language js source='
import * as m from "/opt/Actian/vectorwise-udf/import/md5.js"
return m.md5(a);
',commutative=true;\g
Conversely, when using unsecure UDFs, the path can point to any location on the local host.
On VectorH, imported files must be available on all nodes.
Last modified date: 03/21/2024