Rate This Document
Findability
Accuracy
Completeness
Readability

Installing the UDF Plugin

Prerequisites

  • Operations in this section are required only when OmniOperator user-defined functions (UDFs) are used. Currently the OmniOperator UDF plugin must be Simple UDF, which is used to execute UDFs compiled based on the Hive UDF framework.
  • OmniOperator UDFs support expression row-by-row processing and batch processing. The two methods can be switched using the configuration file.

Configuring the OmniOperator UDF plugin requires related JAR packages and configuration files, including udf.zip, conf.zip, and udf.properties. The udf.zip package contains all UDF class files, the conf.zip file includes the configuration file on which OmniOperator UDFs depend, and udf.properties is the OmniOperator UDF configuration file. The following uses the udfName1 and udfName2 functions as an example to describe the content format of the udf.properties file:

udfName1 com.huawei.udf.UdfName1
udfName2 com.huawei.udf.UdfName2

Installing the UDF Plugin Row-by-Row Processing

The following operations must be performed on the management node and all compute nodes.

  1. Create an /opt/omni-operator/hive-udf directory on the management and compute nodes.
    mkdir /opt/omni-operator/hive-udf
  2. Upload the previously mentioned packages to the /opt/omni-operator/hive-udf directory on management and compute nodes.
  3. Decompress the related packages.
    unzip udf.zip
    rm -f udf.zip
    unzip conf.zip
    rm -f conf.zip
  4. In the /opt/omni-operator/conf/omni.conf file, update the UDF configuration.
    1. Open /opt/omni-operator/conf/omni.conf.
      vim /opt/omni-operator/conf/omni.conf
    2. Press i to enter the insert mode and add the following UDF configuration.
      # <----UDF properties---->
      # false indicates expression row-by-row processing and true indicates expression bath processing.
      enableBatchExprEvaluate=false
      # UDF trustlist file path
      hiveUdfPropertyFilePath=/opt/omni-operator/hive-udf/udf.properties
      # Directory of the Hive UDF JAR package
      hiveUdfDir=/opt/omni-operator/hive-udf/udf
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. Use vim to open the ~/.bashrc file and add LD_LIBRARY_PATH to the file to update environment variables.
    1. Open the ~/.bashrc file.
      vim ~/.bashrc
    2. Press i to enter the insert mode and add LD_LIBRARY_PATH to update environment variables.
      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${JAVA_HOME}/jre/lib/aarch64/server
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Update the environment variables.
      source ~/.bashrc

You can customize the example names of the udf.zip and conf.zip packages based on your service requirements.

Installing the UDF Plugin Batch Processing

After installing row-by-row processing, perform the following steps on the management node and all compute nodes:

Modify the omni.conf file.

  1. Open /opt/omni-operator/conf/omni.conf.
    vim /opt/omni-operator/conf/omni.conf
  2. Press I to enter the insert mode and update the UDF row-by-row and batch processing configurations.
    enableBatchExprEvaluate=true
  3. Press Esc, type :wq!, and press Enter to save the file and exit.