Prerequisites

  1. The UDF JAR must be present in the Hive Auxiliary JARs path.
    To create an Auxiliary JAR path, see Cloudera Documentation on Creating Temporary Functions.
  2. If you want to use Permanent functions, following are the additional prerequisites:
    1. Create permanent functions as shown in the following example:

      Execute the following command from Hive CLI/Hue/Hive browser: CREATE FUNCTION toChar AS 'com.ofs.aai.service.dmt.udf.custom.TO_CHAR USING JAR 'hdfs:///path/to/jar'

      Note:

      Schema name should be specified initially before Function name. By default, the default schema will be used.
    2. Check if the UDF can be accessed through Hive Console.
    To register User Defined Functions:
  3. From the UDF Summary window, click Add from the toolbar.
    The UDF Registration window is displayed.

    Figure 7-30 UDF Registration window


    This image displays the UDF Registration window.

    Table 7-9 Fields in the UDF Registration and their Descriptions

    Field Description
    Fields marked in red asterisk (*) are mandatory.
    Function Name Enter the function name.
    Function Description Enter a description of the function.
    Origin Select the Origin from the drop-down list. Only HIVE is supported now.
    Type Select the function type from the drop-down list. The options are TEMPORARY and PERMANENT.

    Note:

    Permanent Functions must be saved individually from Hive CLI/Hue/Hive browser before registering in OFSAAI using the UI.
    Category Select the category of the function from the drop-down list. For HIVE, the categories available are UDF, UDAF, and UDTF.
    Function Arguments Enter the arguments to be passed for the function.

    For example, STRING and INT.

    Class Name Enter the class name of the function.
    Return Type This field is not application for HIVE UDFs.
    Jar Path This field is not application for HIVE UDFs.

    Note:

    For HIVE, the jars should be present in the Hive Auxiliary JARs directory.
  4. Click Save.