Javatpoint Logo

91-9990449935

 0120-4256464

Pig UDF (User Defined Functions)

For custom processing Pig provides user defined functions (UDFs) . Currently PIG UDFs are implemented in three languages Java, Python and Ruby.

  • All UDFs must extend "org.apache.pig.EvalFunc"
  • All functions must override "exec" method.

Let's see an example of simple EVAL Function to convert to upper.

Create a jar of the above code as myudfs.jar.

Now write the script in a file and save it as .pig. Here I am using script.pig.

Finally run the script in the terminal to get the output.

Next TopicSqoop Tutorial