自定义udf函数步骤:
1.继承UDF类
2.重写evaluate方法
3.把项目打成jar包
4.hive中执行命令add jar /home/jrjt/dwetl/PUB/UDF/udf/GetProperty.jar;
5.创建函数create temporary function get_pro as 'jd.Get_Property'//jd.jd.Get_Property为类路径;
永久udf函数创建:
1、hdfs dfs -put udftimestamp.jar /udf/
2、add jar hdfs://nameservice1:8020/udf/udftimestamp.jar;
3、CREATE FUNCTION dm_lots.udftimestamp AS 'mytimestamp.MyUDFTimestamp' using jar 'hdfs://nameservice1:8020/udf/udftimestamp.jar';
删除udf函数
drop function dm_lots.udftimestamp;
查看udf函数
show functions
匿名回答于2024-06-04 09:11:57