Map-reduce code for finding average salary

0 votes

I have a file with below details
emp_id,salary
a,1000
b,3000

If I want to write a map-reduce code for finding average salary among all the employees, What will my key-value pair for mapper and reducer as input and output?

May 22, 2019 in Big Data Hadoop by Janan
3,734 views

1 answer to this question.

0 votes

You can choose your mapper output key to be a string such as 

Mapper <key,value> = "average salary ",1000

                                     "average salary ",3000

Reducer input <key,value> =  "average salary ",(1000,3000)

Reducer output <key,value> = "average salary ",4000

answered May 22, 2019 by Yogi

Related Questions In Big Data Hadoop

+2 votes
1 answer

How to calculate Maximum salary of the employee with the name using the Map Reduce Technique

Please try the below code and it ...READ MORE

answered Jul 25, 2018 in Big Data Hadoop by Neha
• 6,300 points
5,688 views
0 votes
1 answer

How to set the number of Map & Reduce tasks?

The map tasks created for a job ...READ MORE

answered Apr 18, 2018 in Big Data Hadoop by Shubham
• 13,490 points
1,947 views
0 votes
1 answer

Map and Reduce task memory settings in Hadoop YARN

It's preferable and generally, it is recommended ...READ MORE

answered Apr 18, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
1,219 views
0 votes
1 answer

Setting the Number of Map tasks and Reduce Tasks not Working

The command that you are running is ...READ MORE

answered May 4, 2018 in Big Data Hadoop by Ashish
• 2,650 points
1,515 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
11,078 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
2,575 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
109,076 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
4,644 views
0 votes
1 answer

Which is the most preferable language for Hadooop Map-Reduce programs?

MapReduce is a programming model to perform ...READ MORE

answered Aug 4, 2018 in Big Data Hadoop by Neha
• 6,300 points
3,780 views
0 votes
1 answer

Junit test for Map Reduce Hadoop

Hi. This is the code I used ...READ MORE

answered Dec 17, 2018 in Big Data Hadoop by Omkar
• 69,220 points
2,573 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP