125
Apache Pig MIN Function
The Apache Pig MIN function is used to find out the minimum of the numeric values or chararrays in a single-column bag. It requires a preceding GROUP ALL statement for global minimums and a GROUP BY statement for group minimums. However, it ignores the NULL values.
Syntax
Here,
exp – It is an expression with data types like chararray, int, float, long, etc.
Example of MIN Function
In this example, we will find out the minimum of the given values.
Steps to execute MIN Function
- Create a text file in your local machine and insert the list of tuples.
- Check the tuples inserted in the text files.
- Upload the text files on HDFS in the specific directory.
- Open the pig MapReduce run mode.
- Load the file that contains the data.
- Now, execute and verify the data.
- Let’s group the data on the basis of ‘a1’ field.
- Let’s return the minimum of given numeric values.
Here, we got the desired output.
Next TopicSIZE Function