码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • hive2.x中自定义函数未注册上解决


    项目场景:

    1、hive2.x的环境,项目中使用hiveSQL使用自定义函数hiveUDF


    问题描述

    4台hiveserver2节点,其中两台不能执行:自定义函数

    通过show functions like '*udf*';查询没有


    原因分析:

    Reload Function

    Version information

    As of Hive 1.2.0 (HIVE-2573).

    RELOAD (FUNCTIONS|FUNCTION);

    As of HIVE-2573, creating permanent functions in one Hive CLI session may not be reflected in HiveServer2 or other Hive CLI sessions, if they were started before the function was created. Issuing RELOAD FUNCTIONS within a HiveServer2 or HiveCLI session will allow it to pick up any changes to the permanent functions that may have been done by a different HiveCLI session. Due to backward compatibility reasons RELOAD FUNCTION; is also accepted.

    从 HIVE-2573 开始,在一个 Hive CLI 会话中创建永久函数可能不会反映在 HiveServer2 或其他 Hive CLI 会话中,如果它们是在创建函数之前启动的。在 HiveServer2 或 HiveCLI 会话中发出 RELOAD FUNCTIONS 将允许它获取对不同 HiveCLI 会话可能已完成的永久功能的任何更改。由于向后兼容的原因 RELOAD FUNCTION;也被接受。

     官方参考:LanguageManual DDL - Apache Hive - Apache Software Foundation

    以下为hive2.x的reloadFuntions源码

    1. public void reloadFunctions() throws HiveException {
    2. HashSet registryFunctions = new HashSet(
    3. FunctionRegistry.getFunctionNames(".+\\..+"));
    4. for (Function function : getAllFunctions()) {
    5. String functionName = function.getFunctionName();
    6. try {
    7. LOG.info("Registering function " + functionName + " " + function.getClassName());
    8. String qualFunc = FunctionUtils.qualifyFunctionName(functionName, function.getDbName());
    9. FunctionRegistry.registerPermanentFunction(qualFunc, function.getClassName(), false,
    10. FunctionTask.toFunctionResource(function.getResourceUris()));
    11. registryFunctions.remove(qualFunc);
    12. } catch (Exception e) {
    13. LOG.warn("Failed to register persistent function " +
    14. functionName + ":" + function.getClassName() + ". Ignore and continue.");
    15. }
    16. }
    17. // unregister functions from local system registry that are not in getAllFunctions()
    18. for (String functionName : registryFunctions) {
    19. try {
    20. FunctionRegistry.unregisterPermanentFunction(functionName);
    21. } catch (Exception e) {
    22. LOG.warn("Failed to unregister persistent function " +
    23. functionName + "on reload. Ignore and continue.");
    24. }
    25. }
    26. }

    解决方案:

    1、beeline连接到对应hiveserver2节点(注意:不能执行此函数的所有hiveserver2节点)

    2、执行 RELOAD (FUNCTIONS|FUNCTION);

  • 相关阅读:
    后台开发核心技术与应用实践看书笔记(三):常用STL的使用
    获取随机id的api接口
    汇川Easy521PLC与压力传感器485通讯实例
    MySQL – FOUND_ROWS() 函数用于受影响的总行数
    Fundamentals of Electrostatic Discharge-WHO DEVELOPS STANDARDS?
    化繁为简 面板式空调网关亮相上海智能家居展 智哪儿专访青岛中弘赵哲海
    R语言缺失时间序列的填充及合并:补齐时间序列数据中所有缺失的时间索引、使用merge函数合并日期补齐之后的时间序列数据和另外一个时间序列数据(补齐右侧数据)
    数据通信网络之IPv6以太网多层交换
    jdk环境变量配置、maven环境变量配置
    C++-Cmake指令:add_custom_target【增加一个没有输出的目标,使得它总是被构建】
  • 原文地址:https://blog.csdn.net/NeverGiveup54/article/details/126586140
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号