一。临时添加UDF函数
,,1。上传的jar包至蜂巢服务器
,,2.蜂巢壳执行如下命令:,
add jar /home/蜂巢/hivejar/billing-on-hive-1.0.jar create temporary  function strip  as “com.tsingzone.bigdata.billing.GetOperator”; 注: 条:自定义函数名 com.tsingzone.bigdata.billing.GetOperator:类名 仅对当前壳生效
,3。使用方法:
,,,
select 地带(dest_termi_id),得到huadan201601 limit 10;
二。永久添加UDF函数
,,1 .上传的jar包至hdfs中
,,,,
hdfs dfs -put hivejar/billing-on-hive-1.0.jar /user/蜂巢/hive_jar
,,2 .创建函数
,,,,
create function billing as “com.tsingzone.bigdata.billing.GetOperator”, using jar “hdfs:///user/蜂巢/hive_jar billing-on-hive-1.0.jar”
,,3 .使用
,,,,
hive -S -e “select 计费(dest_termi_id),得到huadan201601 limit 10;”
,,,
,,参考文档:http://blog.csdn.net/liam08/article/details/51311772