In the cluster, you log into Hive, and run a command from Beeline to make the UDF functional in Hive queries. The UDF persists between HiveServer restarts.
You need to set up UDF access, using a Ranger policy for example.
In this task, the registration command differs depending on the method you choose
to configure the cluster for finding the JAR. If you use the Hive aux library directory
method that involves a symbolic link, you need to restart HiveServer after registration.
If you use the direct JAR reference method, you do not need to restart HiveServer. You
must recreate the symbolic link after any patch or maintenance upgrades that deploy a
new version of Hive.
-
Using Beeline, login to HiveServer as a user who has UDF access.
HiveServer, for example:
beeline -u jdbc:hive2://mycluster.com:10000 -n hive -p
-
At the Hive prompt, select a database for use.
USE default;
-
Run the registration command that corresponds to the way you configured the
cluster to find the JAR.
In the case of the direct JAR reference configuration method, you include the
JAR location in the command. If you use another method, you do not include the
JAR location. The classloader can find the JAR.
-
Check that the UDF is registered.
You scroll through the output and find
default.typeof
.