Building the project and uploading the JAR

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.
  1. Build the IntelliJ project.
    [INFO] Building jar: /Users/max/IdeaProjects/hiveudf/target/TypeOf-1.0-SNAPSHOT.jar
    [INFO] ------------------------------------------------------------------------
    [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
  2. In IntelliJ, navigate to the JAR in the /target directory of the project.
  3. Configure the cluster so that Hive can find the JAR using the direct reference method.
    1. Upload the JAR to HDFS.
    2. 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
  4. In IntelliJ, click Save.
  5. Click Actions > Deploy Client Configuration.
  6. Restart the Hive service.