writing custom functions that use external java classes on Hive
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.
精彩评论