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
117 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
554 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,300 points
90 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,260 points
89 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
153 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,690 points
3,097 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,690 points
349 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
15,203 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,260 points
1,128 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
60 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,600 points
431 views