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
17 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 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,280 points
362 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,290 points
54 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
67 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
121 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
• 10,490 points
2,306 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
• 10,490 points
237 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
11,898 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
880 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,280 points
49 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,290 points
327 views