Hive How to Write a User Defined Function in Big Data Hadoop
Create a Java class for the User Defined Function which extends ora.apache.hadoop.hive.sq.exec.UDF and implements more than one evaluate() methods.
Package Java class into a JAR file (Maven)
Go to Hive CLI, add JAR, and verify JARs is in the Hive CLI classpath.
CREATE TEMPORARY FUNCTION in Hive which points to Java class
Use it in Hive SQL.
--------------------------
hive> ADD /home/cloudera/HiveUDFs/target/HiveUDFs-0.0.1-SNAPSHOT.jar;
hive> list jars;
hive> CREATE TEMPORARY FUNCTION STRIP AS 'org.telcom.bigdata.Strip';
Post Your Comment