You are on page 1of 5

TYIT DATE – 09/04/2021

BIG DATA AND NEXT GENERATION UID – 18BIT043


PRACTICAL NO 5
B)

AIM – Write a pig script to find the number of products sold in each country. Also demonstrate the
use of LOAD, CROSS, DISTINCT, FILTER, FOREACH operators.

COMMANDS –

1) Run pig in mapreduce mode

pig –x mapreduce

2) Load the file containing data

3) Group the data by field country

4) For each tuple in GroupByCountry, generate the resulting string in the form -> Name of
country: No of products sole

5) Store results in the directory ‘pig_output_sales’ on HDFS


TYIT DATE – 09/04/2021
BIG DATA AND NEXT GENERATION UID – 18BIT043
PRACTICAL NO 5

6) LOAD OPERATOR

pload.txt
TYIT DATE – 09/04/2021
BIG DATA AND NEXT GENERATION UID – 18BIT043
PRACTICAL NO 5

7) CROSS OPERATOR

pcross1.txt
TYIT DATE – 09/04/2021
BIG DATA AND NEXT GENERATION UID – 18BIT043
PRACTICAL NO 5
pcross2.txt

OUTPUT –
TYIT DATE – 09/04/2021
BIG DATA AND NEXT GENERATION UID – 18BIT043
PRACTICAL NO 5
8) DISTINCT OPERATOR

OUTPUT –

9) FILTER OPERATOR

OUTPUT –

10) FOREACH OPERATOR

OUTPUT –

You might also like