How to Write User Defined Functions for Hive
Hive offers several built-in functions that can be used when querying data in Hive. They come in very handy when you want to do some basic calculations, string manipulations or simply work with date values in different formats.
A simple example would be the greatest() function that returns the greatest value of a given list of values.
Although Hive comes with a comprehensive list of built-in functions, you might find yourself in the situation where the desired function to process your data is not on that list. Fortunately, this is not an issue at all as Hive allows you to develop user-defined functions, also known as UDF. What’s even better, it doesn’t take an Einstein to build UDFs, you just need to know a little Java and soon you’ll be able to use your new UDF in a Hive query.