You compile the UDF code into a JAR and add the JAR to the classpath on the
cluster.
Use the direct reference method to configure the cluster
to find the JAR. It is a straight-forward method, but recommended for development
only.
-
Build the IntelliJ project.
...
[INFO] Building jar: /Users/max/IdeaProjects/hiveudf/target/TypeOf-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.820 s
[INFO] Finished at: 2019-04-03T16:53:04-07:00
[INFO] Final Memory: 26M/397M
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
-
In IntelliJ, navigate to the JAR in the
/target
directory of
the project.
-
Configure the cluster so that Hive can find the JAR using the direct reference
method.
-
Upload the JAR to HDFS.
-
Move the JAR into the Hive warehouse. For example, in CDP Data
Center:
$ hdfs dfs -put TypeOf-1.0-SNAPSHOT.jar /warehouse/tablespace/managed/hiveudf-1.0-SNAPSHOT.jar
-
In IntelliJ, click Save.
-
Click .
-
Restart the Hive service.