HIVE的UDF

HIVE的UDF
    新建java工程,导入hive相关包,导入hive相关的lib。
    创建类继承UDF
    自己编写一个evaluate方法,返回值和参数任意。
    为了能让mapreduce处理,String要用Text处理。
    将写好的类打成jar包,上传到linux中
    在hive命令行下,向hive注册UDF:add jar /xxxx/xxxx.jar
    为当前udf起一个名字:create temporary function fname as '类的全路径名';
    之后就可以在hql中使用该自定义函数了。

原文地址:https://www.cnblogs.com/zpb2016/p/5791629.html