码迷,mamicode.com
首页 > 其他好文 > 详细

HIVE的UDF

时间:2015-08-25 19:13:55      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:

0.要继承org.apache.hadoop.hive.ql.exec.UDF类实现evaluate

自定义函数调用过程:
1.添加jar包(在hive命令行里面执行)
hive> add jar /root/NUDF.jar;

2.创建临时函数
hive> create temporary function getNation as ‘cn.itcast.hive.udf.NationUDF‘;

3.调用
hive> select id, name, getNation(nation) from beauty;

4.将查询结果保存到HDFS中
hive> create table result row format delimited fields terminated by ‘\t‘ as select * from beauty order by id desc;
hive> select id, getAreaName(id) as name from tel_rec;


create table result row format delimited fields terminated by ‘\t‘ as select id, getNation(nation) from beauties;

HIVE的UDF

标签:

原文地址:http://www.cnblogs.com/dandandeyoushangnan/p/4757999.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!