Apache Pig – Java Pig UDF to Uppercase a String

java pig udf

This article will explain how to se a Java UDF to Uppercase a String in a very simple way. First of all, we must define what an UDF is and how it is used in Apache PIG.

User Desined Functions (UDFs) are a great way to enhance ETL (Extract, Transform, Load) processing you could do on a PIG script. Since Pig (MapReduce) records are always contained within Tuples and Bags, it is very easy to implement them in Java and then return the value(s) you need to transform. Also note that you could do this UDFs in several programming languages such as python and javascript. This java UDF version will be presented in this post for illustration purposes.

This UDF is straight forward. It Uppercases a string when given a tuple string.

On a pig script, the code would look like this:

Java Pig UDF to Uppercase a String

Here is a list of UDFs