CREATE TRANSFORM FUNCTION
Adds to the catalog a user-defined transform function (UDTF) that is stored in a shared Linux library. CREATE TRANSFORM FUNCTION automatically determines the function parameters and return value from data supplied by the factory class. Vertica supports overloading transform functions. When you call the SQL function, Vertica passes the input table to the transform function in the library to process.
Syntax
CREATE [ OR REPLACE ] TRANSFORM FUNCTION function‑name AS [ LANGUAGE 'language' ] NAME 'factory' LIBRARY library [ FENCED | NOT FENCED ]
Parameters
OR REPLACE |
Specifies to overwrite an existing function of the same name and matching arguments; otherwise the CREATE statement returns with a rollback error. |
function‑name |
Identifies the function to create, where function conforms to conventions described in Identifiers. This name does not need to match the name of the factory, but it is less confusing if they are the same or similar. |
LANGUAGE 'language' |
The language used to develop this function, one of the following:
|
NAME 'factory' |
Name of the shared library factory class or R factory function that generates the object to handle function processing. |
LIBRARY library |
Name of the shared library that contains the object to process this function. This library must already be loaded by CREATE LIBRARY. |
FENCED | NOT FENCED |
Enables or disables fenced mode for this function. Functions written in R always run in fenced mode. Default: |
Privileges
Non-superuser:
- CREATE privilege on the function's schema
- USAGE privilege on the function's library
Restrictions
A query that includes a UDTF cannot:
- Include statements other than the SELECT statement that calls this UDTF and a PARTITION BY expression
- Call an analytic function
- Call another UDTF
- Include one of the following clauses:
Examples
This example shows how to add a UDTF to the catalog.
=> CREATE TRANSFORM FUNCTION transFunct AS LANGUAGE 'C++' NAME 'myFactory' LIBRARY myFunction;