io - Hadoop Custom Values for a key -
i tried implement custom writable instead of using intwritable. reason behind want have pair of values. in particular want achieve following: user_id;counter;length_of_messages;
the input files of following sort:
user_id;time_stamp;length_of_messages
the output files should aggregate information
user_id;counter;length_of_messages
semantically, stats of user given periond (e.g. 1 week) aggregating number of times wrote message in week, , sum of lengths of messages in week.
public class valueswritable implements writable { private int counter; private int durations; public void write (dataoutput out) throws ioexception{ out.writeint(counter); out.writeint(durations); } public void readfields(datainput in) throws ioexception{ counter = in.readint(); durations = in.readint(); } public valueswritable read(datainput in) throws ioexception{ valueswritable v = new valueswritable(); v.readfields(in); return v; } }
i included class innerclass in mapreduce job class. question is: how can interface class? dataoutput , datainput? read tutorial http://developer.yahoo.com/hadoop/tutorial/module5.html#keytypes , modified example purpose. can't compile classes.
thanks directions.
Comments
Post a Comment