首页 > 其他 > 详细

hive 部署UDF函数

时间:2017-06-07 14:04:39      阅读:312      评论:0      收藏:0      [点我收藏+]

一.临时添加UDF函数

    1.上传jar包至hive服务器

    2.hive shell执行如下命令:  

add jar /home/hive/hivejar/billing-on-hive-1.0.jar
create temporary function strip as ‘com.tsingzone.bigdata.billing.GetOperator‘;
注:
strip:自定义函数名
com.tsingzone.bigdata.billing.GetOperator:类名
仅对当前shell生效

   3.使用方法:

     

select strip(dest_termi_id) from huadan201601 limit 10;

二.永久添加UDF函数

    1.上传jar包至hdfs中

      

hdfs dfs -put hivejar/billing-on-hive-1.0.jar /user/hive/hive_jar

    2.创建函数

      

create function billing as ‘com.tsingzone.bigdata.billing.GetOperator‘ using jar ‘hdfs:///user/hive/hive_jar/billing-on-hive-1.0.jar‘

    3.使用

       

hive -S -e "select billing(dest_termi_id) from huadan201601 limit 10;"

     

   参考文档:http://blog.csdn.net/liam08/article/details/51311772

hive 部署UDF函数

原文:http://sjitwant.blog.51cto.com/3661219/1932990

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!