在 Hive 上编写使用外部 java 类的自定义函数

发布于 2024-09-29 10:47:45 字数 144 浏览 0 评论 0原文

我一直在想如何在 Hive 中做到这一点。

例如,我想在日志文件中提取一个特定字段(这在 Hive 中已经可以实现),然后我想将该字段的值映射到其他内容。该映射由在 Java 类中编码的自己的自定义业务逻辑决定。 如何在 Hive 中使用这个 Java 类?

I've been thinking of how to do it in Hive.

For e.g. i've a specific field in a log file that I want to extract (this is already possible in Hive) and then I want to map this field's value to something else. This mapping is determiened by own customic business logic that is coded up in a Java Class.
How can I use this Java class in Hive?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

街角迷惘 2024-10-06 10:47:45

您应该按照此处的说明进行操作:UDF 信息 创建可调用的用户定义函数如 substr、计数或长度。

You should follow the instructions here: UDF Information to create a User Defined Function which can be called like substr, count or length.

相对绾红妆 2024-10-06 10:47:45

您将需要

add jar  myjar.jar;

在 hive 脚本中使用,就像您对包含 UDF 的 jar 所做的那样。我建议将它们全部包装在一个罐子中。

You will need to use

add jar  myjar.jar;

in the hive script, just as you had done with the jar containing the UDF. I would recommend packaging them all up in a single jar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文