hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jay Vyas <jayunit...@gmail.com>
Subject Re: Determine the key of Map function
Date Tue, 24 Apr 2012 02:52:17 GMT
Its somewhat tricky to understand exactly what you need from your
explanation, but I believe you want teachers who have the most students in
a given class.  So for English, i have 10 teachers teaching the class - and
i want the ones with the highes # of students.

You can output key= <classid>, value=<-1*#ofstudent,teacherid> as the

The values will then be sorted, by # of students.  You can thus pick
teacher in the the first value of your reducer, and that will be the
teacher for class id = xyz , with the highes number of students.

You can also be smart in your mapper by running a combiner to remove the
teacherids who are clearly not maximal.

On Mon, Apr 23, 2012 at 9:38 PM, Lac Trung <trungnb3535@gmail.com> wrote:

> Hello everyone !
> I have a problem with MapReduce [:(] like that :
> I have 4 file input with 3 fields : teacherId, classId, numberOfStudent
> (numberOfStudent is ordered by desc for each teach)
> Output is top 30 classId that numberOfStudent is max for each teacher.
> My approach is MapReduce like Wordcount example. But I don't know how to
> determine key for map function.
> I run Wordcount example, understand its code but I have no experience at
> programming MapReduce.
> Can anyone help me to resolve this problem ?
> Thanks so much !
> --
> Lạc Trung
> 20083535

Jay Vyas

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message