Was this helpful?
JavaScript UDFs
JavaScript UDFs are enabled by default, as described in Prerequisites to Configure Non-containerized UDFs in the System Administrator Guide.
Note:  eval() function is not allowed in JavaScript UDFs.
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 containerized 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 non-containerized UDFs, the path can point to any location on the local host.
On VectorH, imported files must be available on all nodes.
Data Type Mapping
Vector data types map to JavaScript data types as follows:
Vector Data Type
JavaScript Data Type
INTEGER1 (TINYINT)
INTEGER2 (SMALLINT)
INTEGER4 (INTEGER)
Int32
IPv4
Int32
INTERVAL YEAR TO MONTH
Int32
CHAR
VARCHAR
NCHAR
NVARCHAR
String
BOOLEAN
Boolean
FLOAT4
Double
DECIMAL
Double
FLOAT
Double
MONEY
Double
ANSIDATE
Date (no timezone)
TIME WITHOUT TIME ZONE
TIME WITH LOCAL TIME ZONE
TIME WITH TIME ZONE
TIMESTAMP WITHOUT TIME ZONE
TIMESTAMP WITH LOCAL TIME ZONE
TIMESTAMP WITH TIME ZONE
Date (no timezone)
INTEGER8 (BIGINT)
BigInt
IPv6
BigInt
UUID
BigInt
INTERVAL DAY TO SECOND
BigInt
Last modified date: 04/15/2025