(Optional) Installing and Executing the Spark UDF Service
The Spark UDF service needs to be executed only when OmniOperator UDFs are used. Before executing the Spark UDF service, you need to execute 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 native Spark.
Installing the Spark UDF Plugin
- Check that the Spark engine has been installed (see Installing SparkExtension) before installing the Spark UDF plugin.
- 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.
- Register Hive UDFs on the management node of the cluster.
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.6.0-aarch64.jar to the spark.driver.extraClassPath parameter.
- The result in version 3.1.1 is as follows:
1--conf spark.driver.extraClassPath=/opt/omni-operator/lib/boostkit-omniop-spark-3.1.1-1.6.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-bindings-1.6.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-udf-1.6.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.6.0.jar
- The result in version 3.3.1 is as follows:
1--conf spark.driver.extraClassPath=/opt/omni-operator/lib/boostkit-omniop-spark-3.3.1-1.6.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-bindings-1.6.0-aarch64.jar:/opt/omni-operator/lib/boostkit-omniop-udf-1.6.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.6.0.jar
- The result in version 3.1.1 is as follows:
- Append /opt/omni-operator/lib/boostkit-omniop-udf-1.6.0-aarch64.jar to the spark.executor.extraClassPath parameter.
- The result in version 3.1.1 is as follows:
1--conf spark.executor.extraClassPath='${PWD}/omni/omni-operator/lib/boostkit-omniop-spark-3.1.1-1.6.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-bindings-1.6.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-udf-1.6.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.6.0.jar'
- The result in version 3.3.1 is as follows:
1--conf spark.executor.extraClassPath='${PWD}/omni/omni-operator/lib/boostkit-omniop-spark-3.3.1-1.6.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-bindings-1.6.0-aarch64.jar':'${PWD}/omni/omni-operator/lib/boostkit-omniop-udf-1.6.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.6.0.jar'
- The result in version 3.1.1 is as follows:
Parent topic: Using on Spark