使用hive会话关闭清理资源

6tqwzwtp  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(375)

我需要在自定义udf中创建一些资源(带有二进制数据的地理编码器)的对象。这些资源应该为一个udf创建一次,并且每个Map器将持有该资源的单个示例,因此我使用一个创建该资源并持有其静态引用的单例工厂。
为了处理这些资源,我使用了一个shutdown hook,如果我从控制台退出,它可以很好地处理hivecli控制台(putty),而不是处理所有资源。
但是我不能用hue ui处理这些资源,即使我关闭了配置单元会话,这些资源仍然存在。
有人能帮我找到一个更干净的方法来处理这些资源与用户界面。
作为解决方法,我创建了一个新的udf来处理这些资源- SELECT DisposeGeocoders(); . 但这对用户来说是一个开销。

jyztefdp

jyztefdp1#

在您的环境中,hue.init文件中的这些值是什么(默认值为true,但我要检查以下属性:


# Use session-length cookies. Logs out the user when she closes the browser window.

expire_at_browser_close=true

# Hue will try to close the Hive query when the user leaves the editor page.

# This will free all the query resources in HiveServer2, but also make its results inaccessible.

close_queries=true

# Use session-length cookies. Logs out the user when she closes the browser window.

expire_at_browser_close=true

相关问题