JBoss.orgCommunity Documentation

Chapter 8. User Defined Functions

8.1. Modeling your functions
8.2. Utilizing your UDFs in transformations
8.3. Including functions in your VDB

Teiid Designer enables users to extend Teiid's scalar or aggregate function library via modeling and definition of custom or User Defined Functions(UDFs).

The following are used to define a UDF.

Even Pushdown required functions need to be added as a UDF to allow Teiid to properly parse and resolve the function. Pushdown scalar functions differ from normal user-defined functions in that no code is provided for evaluation in the engine. An exception will be raised if a pushdown required function cannot be evaluated by the appropriate source.

Teiid Designer provides a new object wizard to assist in modeling your UDF. Simply right-click select a model and right-click select New > Procedure action. In the wizard there will be an option to specify the functions's jar location on your file system, as well as the java class and java method. (See Section 6.2.2, “Create Relational Procedure Wizard” for further information)

If creating a function by other means, you'll need to select the procedure and edit the different properties for the procedure in the Properties view.

A User Defined Function represents a defined method in a java class. In order for the Teiid runtime to register the function and allow it's use in your transformations, you'll need to specify the following as properties in the figure above:

Once you've modeled your functions you can use your function calls in your transformation SQL. These functions will be accessible through the Transformation Editor's expression builder wizard, just like any other built-in function. (See Section, “Using the Expression Builder” for further information)

In order for Teiid to become aware of your functions, the actual code must be deployed on your server and available to your Teiid submodule. Your Teiid Designer workspace is aware of any models containing functions and their referenced jars and class info. When a source model containing UDFs is added to a VDB, the jar containing the defined function will be added to your VDB and visible in the VDB Editor's UDF Jars tab.