开发者

writing custom functions that use external java classes on Hive

开发者 https://www.devze.com 2023-01-22 06:14 出处:网络
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 some

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. Th开发者_运维问答is 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?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消