我要评分
获取效率
正确性
完整性
易理解

(Optional) Installing and Executing the Spark UDF Service

The Spark UDF service is required only when using OmniOperator to accelerate UDFs. Before starting the Spark UDF service, start the Spark engine service. The OmniOperator UDF plugin supports only simple UDFs. If OmniOperator UDFs are not available, the plugin will be rolled back to the open source Spark.

Installing the Spark UDF Plugin

  1. Check that the Spark engine has been installed (see Installing SparkExtension) before installing the Spark UDF plugin.
  2. Place the JAR packages on which the UDFs depend to the /user/hive-udf directory of HDFS.
    • The /user/hive-udf directory can be customized.
    • The JAR packages on which the UDFs depend need to be provided by yourself.
  3. Register Hive UDFs on the management node of the cluster.

    For details about how to register UDFs, see Integration with Hive UDFs/UDAFs/UDTFs.

Executing the Spark UDF Service

For details about how to execute SQL statements, view the execution plans, and compare results, see Executing Spark Services.

For details, see Executing Spark Services. You only need to add the following parameters to the command of starting the Spark SQL CLI of SparkExtension.

  • Append /opt/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar to the spark.driver.extraClassPath parameter.
    • The result in Spark 3.1.1 is as follows:
      1
      --conf spark.driver.extraClassPath=/opt/omni-operator/lib/boostkit-omniop-spark-3.1.1-1.8.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-bindings-1.8.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar:/opt/omni-operator/lib/dependencies/protobuf-java-3.15.8.jar:/opt/omni-operator/lib/dependencies/boostkit-omniop-native-reader-3.1.1-1.8.0.jar
      
    • The result in Spark 3.3.1 is as follows:
      1
      --conf spark.driver.extraClassPath=/opt/omni-operator/lib/boostkit-omniop-spark-3.3.1-1.8.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-bindings-1.8.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar:/opt/omni-operator/lib/dependencies/protobuf-java-3.15.8.jar:/opt/omni-operator/lib/dependencies/boostkit-omniop-native-reader-3.3.1-1.8.0.jar
      
    • The result in Spark 3.4.3 is as follows:
      1
      --conf spark.driver.extraClassPath=/opt/omni-operator/lib/boostkit-omniop-spark-3.4.3-1.8.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-bindings-1.8.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar:/opt/omni-operator/lib/dependencies/protobuf-java-3.15.8.jar:/opt/omni-operator/lib/dependencies/boostkit-omniop-native-reader-3.4.3-1.8.0.jar
      
    • The result in Spark 3.5.2 is as follows:
      1
      --conf spark.driver.extraClassPath=/opt/omni-operator/lib/boostkit-omniop-spark-3.5.2-1.8.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-bindings-1.8.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar:/opt/omni-operator/lib/dependencies/protobuf-java-3.15.8.jar:/opt/omni-operator/lib/dependencies/boostkit-omniop-native-reader-3.5.2-1.8.0.jar
      
  • Append /opt/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar to the spark.executor.extraClassPath parameter.
    • The result in Spark 3.1.1 is as follows:
      1
      --conf spark.executor.extraClassPath='${PWD}/omni/omni-operator/lib/boostkit-omniop-spark-3.1.1-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-bindings-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/dependencies/protobuf-java-3.15.8.jar':'${PWD}/omni/omni-operator/lib/dependencies/boostkit-omniop-native-reader-3.1.1-1.8.0.jar'
      
    • The result in Spark 3.3.1 is as follows:
      1
      --conf spark.executor.extraClassPath='${PWD}/omni/omni-operator/lib/boostkit-omniop-spark-3.3.1-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-bindings-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/dependencies/protobuf-java-3.15.8.jar':'${PWD}/omni/omni-operator/lib/dependencies/boostkit-omniop-native-reader-3.3.1-1.8.0.jar'
      
    • The result in Spark 3.4.3 is as follows:
      1
      --conf spark.executor.extraClassPath='${PWD}/omni/omni-operator/lib/boostkit-omniop-spark-3.4.3-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-bindings-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/dependencies/protobuf-java-3.15.8.jar':'${PWD}/omni/omni-operator/lib/dependencies/boostkit-omniop-native-reader-3.4.3-1.8.0.jar'
      
    • The result in Spark 3.5.2 is as follows:
      1
      --conf spark.executor.extraClassPath='${PWD}/omni/omni-operator/lib/boostkit-omniop-spark-3.5.2-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-bindings-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-udf-1.8.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/dependencies/protobuf-java-3.15.8.jar':'${PWD}/omni/omni-operator/lib/dependencies/boostkit-omniop-native-reader-3.5.2-1.8.0.jar'