C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Pig UDF (User Defined Functions)To specify custom processing, Pig provides support for user-defined functions (UDFs). Thus, Pig allows us to create our own functions. Currently, Pig UDFs can be implemented using the following programming languages: -
Among all the languages, Pig provides the most extensive support for Java functions. However, limited support is provided to languages like Python, Jython, JavaScript, Ruby, and Groovy. Example of Pig UDFIn Pig,
Let's see an example of a simple EVAL Function to convert the provided string to uppercase. UPPER.java package com.hadoop; import java.io.IOException; import org.apache.pig.EvalFunc; import org.apache.pig.data.Tuple; public class TestUpper extends EvalFunc
$ nano pigsample
$ hdfs dfs -put pigexample /pigexample
$ nano pscript.pig
$pig pscript.pig Here, we got the desired output.
Next TopicLOAD Operator
|