hive hdfs 永久注册udf

环境(官网hive 0.13版本支持永久函数udf)
hive hive-common-1.1.0-cdh5.13.0
步骤
先上传jar包到HDFS到指定路径(自己定)

  • CREATE FUNCTION 函数名 AS ‘包名.类名’ USING JAR ‘hdfs:///path/xxxx.jar’;
  • CREATE FUNCTION IntegerFunc AS ‘udf.IntegerValueUDF’ USING JAR ‘hdfs:///dir/*.jar’;
    删除永久函数:
  • drop function 数据库名.函数名字;
    临时注册:
    add jar /path/xx.jar(存储在本地磁盘)
    // 临时注册UDF函数(hive会话生效)
    create temporary function 函数名 as ‘包名.类名’;
    删除临时函数:
  • drop temporary function 数据库名.函数名;
    注意: 在用 insert into select 函数(字段) from table
    改用 insert overwrite select 函数(字段) from table
    避免 建函数对不同库具有不同权限

猜你喜欢

转载自blog.csdn.net/weixin_40809627/article/details/82968099