Defining a Pig UDF using the UDF panel - 6.3

Talend Data Fabric Studio User Guide

English (United States)
Talend Data Fabric
Talend Studio
Data Quality and Preparation
Design and Development

Using the UDF panel of tPigMap you can easily define Pig UDFs, especially those requiring an alias such as some Apache DataFu Pig functions, to be loaded with the input data.

  1. From the Define functions table on the Map Editor, click the button to add a row. The Node and Alias fields are automatically filled with the default settings.

  2. If needed, click in Node field and select from the drop-down list the tPigLoad component you want to use to load the UDF you are defining.

  3. If you want your UDF to have another alias than the proposed one, enter your alias in the Alias field, between double quotation marks.

  4. Click in the UDF function field and click the button that appears to open the [Expression Builder] dialog box.

  5. Select a UDF category from the Categories list. The Functions list shows all the available functions of the selected category.

  6. From the Functions list, double-click the function of interest to add to the Expression area, and click OK to close the dialog box.

    The selected function appears in the UDF function field.

Once you have defined UDFs in this table, the Define functions table of the specified tPigLoad component is automatically synchronized. Likewise, once you have defined UDFs in a connected tPigLoad component, this table is automatically synchronized.

Upon defining a UDF using the UDF panel, you can use it in an expression by:

  • dragging and dropping its alias to the target expression field and editing the expression as required

  • opening the [Expression Builder] dialog box as detailed in Editing expressions, selecting User Defined from the Category list, double-clicking the alias of the UDF in the Functions list to add it as an expression, and editing the expression as required.

When done, the alias instead of the function itself appears in the expression.