hive 部署UDF函数
一.临时添加UDF函数 1.上传jar包至hive服务器 2.hive shell执行如下命令: 1 2 3 4 5 6 addjar/home/hive/hivejar/billing-on-hive-1.0.jar createtemporaryfunctionstripas'com.tsingzone.bigdata.billing.GetOperator'; 注: strip:自定义函数名 com.tsingzone.bigdata.billing.GetOperator:类名 仅对当前shell生效 3.使用方法: 1 select strip(dest_termi_id) from huadan201601limit10; 二.永久添加UDF函数 1.上传jar包至hdfs中 1 hdfsdfs-puthivejar/billing- on -hive-1.0.jar/ user /hive/hive_jar 2.创建函数 1 create function billing as 'com.tsingzone.bigdata.billing.GetOperator' usingjar 'hdfs:///user/hive/hive_jar/billing-on-hive-1.0.jar' 3.使用 1 hive-S-e "selectbilling(dest_termi_id)fromhuadan201601limit10;" 参考文档:http://blog.csdn.net/liam08/article/details/51311772 本文转自 穿越防火墙 51CTO博客,原文链接:http://blog.51cto.com/sjitwant/1932990