Question: how to create udf in hive?
Answer: Create a Java class for the User Defined Function which extends ora. ... 
Package your Java class into a JAR file (I am using Maven)
Go to Hive CLI, add your JAR, and verify your JARs is in the Hive CLI classpath.
CREATE TEMPORARY FUNCTION in Hive which points to your Java class.