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 in Big Data Hadoop by Janan
11 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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 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,180 points
267 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
• 12,890 points
41 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,240 points
57 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 3, 2018 in Big Data Hadoop by Ashish
• 2,630 points
100 views
0 votes
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
• 9,670 points
1,882 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
• 9,670 points
168 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
9,411 views
0 votes
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,240 points
678 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 3, 2018 in Big Data Hadoop by Neha
• 6,180 points
40 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
• 67,000 points
257 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.