Writing a user-defined function in Pig