myVertica  

User-Defined Extensions (UDxs)

This topic gives a brief overview of User-Defined Extensions (UDxs) in Vertica.

What is a User-Defined Extension?

User-Defined Extensions (UDxs) are functions contained in external shared libraries developed in C++, R, or Java, using the Vertica SDK. UDxs are best used for analytic operations that are difficult to perform in SQL or need to be performed frequently enough that speed is a major concern. They provide features such as new types of data analysis, and the ability to parse and load new types of data.

The C++ and Java APIs are nearly identical.

Types of UDxs

Vertica supports five types of User-Defined Extensions:
  • User-Defined Aggregate Functions (UDAFs)
    • Used to create custom aggregate functions
    • Read one column of data and return one output column.
    • Compatible with C++.
  • User-Defined Analytic Functions (UDAnFs)
    • Similar to UDSFs, in that they read a row of data and return a single row.
    • Can read input rows independently of outputting rows, so that the output values can be calculated over several input rows.
    • Compatible with C++ and Java.
  • User-Defined Scalar Functions (UDSFs)
    • Can be used anywhere a native function can be used, except CREATE TABLE BY PARTITION and SEGMENTED BY expressions.
    • Take in a single row of data and return a single value.
    • Compatible with C++, Java, and R.
  • User-Defined Transform Functions (UDTFs)
    • Operate on table segments and return zero or more rows of data.
    • Only used in the SELECT list of a query
    • Compatible with C++, Java, and R
  • User-Defined Loads (UDLs)
    • Allows you to create custom parsers to load data.
    • Used in the COPY statement
    • Compatible with C++ and Java.

UDx Structure

To develop a UDx, you need to be familiar with UDx libraries and the various UDx subclasses. For more information, see Developing User-Defined Extensions.

Learn More

To learn more about developing UDxs in Vertica, read the Vertica documentation.