mapreduce - Get max salary employee name using hadoop map reduce -
i new m/r programs..i have file in hdfs data in structure
empid,empname,dept,salary,
1231,username1,dept1,5000
1232,username2,dept2,6000
1233,username3,dept3,7000
.
.
.........................
now want find name of employee earns highest salary
i have written map reduce find highest salary.in mapper class have emitted output
output.collect("max value",salary of emplyee);
in reducer found out max value of key "max value".now want use value in mapper , find names of employee earns maximum salary..how can send reducer output mapper input?is approach accomplish task?any other suggestions?
i make map emit full tuple of max salary. that, create class (for value) implements writable
interface (http://hadoop.apache.org/docs/r1.2.0/api/org/apache/hadoop/io/writable.html). maybe tuplewritable
suits needs (not complex).
since have 1 value emited per map, network not issue , seems fine receive tuple data in reducer. reducer have filter top "max" values.
for more complex problems, have think chaining jobs (http://developer.yahoo.com/hadoop/tutorial/module4.html#chaining)
Comments
Post a Comment