Vertica Analytics Platform Version 9.2.x Documentation
CREATE TRANSFORM FUNCTION
Adds a user-defined transform function (UDTF) stored in a shared Linux library to the catalog. You must have already loaded this library using the CREATE LIBRARY statement. When you call the SQL function, Vertica passes the input table to the transform function in the library to process.
CREATE TRANSFORM FUNCTION automatically determines the parameters and return value for the function from data supplied by the factory class.
Vertica supports overloading transform functions.
CREATE [OR REPLACE] TRANSFORM FUNCTION function‑name AS [LANGUAGE 'language' ] NAME 'factory' LIBRARY library‑name [ FENCED | NOT FENCED ]
||If you omit this parameter, the CREATE TRANSFORM FUNCTION statement fails if an existing function matches the name and parameters of the function you are trying to define. If you supply this parameter, the new function definition overwrites the old one.|
The name to assign to the UDTF. This is the name you use in your SQL statements to call the function.
The language used to develop this function, one of the following:
The name of the factory class or R factory function in the shared library that generates the object to handle the function's processing.
The name of the shared library that contains the object to perform the processing for this function. This library must have been previously loaded using the CREATE LIBRARY statement.
Enables or disables Fenced Mode for this function. Functions written in R always run in fenced mode.
- CREATE privilege on the function's schema
- USAGE privilege on the function's library
UDTF Query Restrictions
A query that includes a UDTF cannot contain:
- Any statements other than the SELECT statement containing the call to the UDTF and a PARTITION BY expression
- Any other analytic function
- A call to another UDTF
- A TIMESERIES clause
- A pattern matching clause
- A gap filling and interpolation clause
This example shows how to add a UDTF to the catalog.
=> CREATE TRANSFORM FUNCTION transFunct AS LANGUAGE 'C++' NAME 'myFactory' LIBRARY myFunction;
Was this topic helpful?