hive 部署UDF函数

发布时间:2020-08-01 22:00:19 作者:hahhahahahah
来源:网络 阅读:540

一.临时添加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

推荐阅读:
  1. Hive基本操作
  2. hive编译源码支持自定义UDF函数

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

hive udf %d

上一篇:折腾Java设计模式之观察者模式

下一篇:宜信开源|手把手教你安装第一个LAIN应用

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》