Simple custom functions simply inherit the UDF class and then refactor the evaluate function to Lowercase.java:Package com.example.hiveudf;import Org.apache.hadoop.hive.ql.exec.UDF;Public final Class lowercase extends UDF {Public string Evaluate (final String s) {if (s = = null) {return null;}return new String (S.tostring (). toLowerCase ()); } }Dependent packages only HIVE-EXEC-0.13.1.JAR,MANIFEST.MF files are:manifest-version:1.0Class-path:Lib/hive-exec-0.13.1.jarMain-class:com.example.hiveudf.lowercaseExport the above Java file as Test.jar and upload it to a directory on the hive installation host, such as/usr/hive/test.jar to perform tests in hive:hive> add Jar/usr/hive/test.jar;hive>create temporary function mylower as ' com.example.hiveudf.LowerCase '; hive>select mylower (' ABCD ');Output: ABCD Delete temp function:hive>drop temporary function mylower;
Hive Custom Function UDF example