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.

select greatest(40,100,3);
----
100

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.

Read full story on runtastic.com

Like what you read? Give Runtastic a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.