Btw, also checkout Avro's MapReduce components. Its a much better serialization framework, and you'll have lesser issues figuring out datatypes to use + more performance from good use of codecs.
On Wed, Jul 20, 2011 at 11:37 AM, Harsh J <ha...@cloudera.com> wrote: > If your key is a "fixed" one of four attributes, why not simply use an > ArrayWritable of Text objects, over a MapWritable? > > On Wed, Jul 20, 2011 at 5:32 AM, Choonho Son <choonho....@gmail.com> wrote: >> I am newbie. >> >> Most of example shows that, >> job.setOutputKeyClass(Text.class); >> >> is it possible job.setOutputKeyClass(MapWritable.class); >> >> because my key is combination of values(src IP, src Port, dst Port, >> dst IP), so I want to use MapWritable as a key. >> >> example code is like: >> >> MapWritable mkey = new MapWritable(); >> MapWritable mval = new MapWritable(); >> >> mkey.put(new Text("sip"), new Text(array[3])); >> mkey.put(new Text("sport"), new Text(array[5])); >> mkey.put(new Text("proto"), new Text(array[7])); >> mkey.put(new Text("dport"), new Text(array[6])); >> mkey.put(new Text("dip"), new Text(array[4])); >> >> >> mval.put(new Text("bcount"), new IntWritable(bcount)); >> mval.put(new Text("pcount"), new IntWritable(pcount)); >> >> context.write(mkey, mval); >> > > > > -- > Harsh J > -- Harsh J