Re: Doubt in implementing TableReduce Interface

2009-07-28 Thread Ninad Raut
the method looks fine. Put some logging inside the reduce method to trace
the inputs to the reduce.  Here's an example... change IntWritable to Text
in your case...
 static class ReadTableReduce2 extends MapReduceBase implements
TableReduceText, IntWritable{

  SortedMapText, Text buzz = new TreeMapText, Text();
  @Override
  public void reduce(Text key,
  IteratorIntWritable values,
  OutputCollectorImmutableBytesWritable, BatchUpdate output,
  Reporter report) throws IOException {

  Integer sum =0;
  while(values.hasNext()) {
  sum += values.next().get();
  }
  if (sum =3) {
  BatchUpdate outval = new BatchUpdate(rowCounter.toString());
  String keyStr = key.toString();
  String[] keyArr=keyStr.split(:);
  outval.put(buzzcount:+keyArr[1], sum.toString().getBytes());
  report.incrCounter(Counters.REDUCE_LINES, 1);
  report.setStatus(sum:+sum);
  rowCounter++;
  output.collect(new ImmutableBytesWritable(key.getBytes()), outval);
  }

  }


On Fri, Jul 24, 2009 at 11:29 PM, bharath vissapragada 
bhara...@students.iiit.ac.in wrote:

 Hi all,

 i have implemented TableMap interface succesfully to emit Text,Text pairs
 .. so now i must implement TableReduce interface to receive those
 Text,Text pairs correspondingly ...  Is the following code correct

 public class MyTableReduce
 extends MapReduceBase
 implements TableReduceText, Text {

  public void reduce(Text key, IteratorText values,
  OutputCollectorImmutableBytesWritable, BatchUpdate output,
  @SuppressWarnings(unused) Reporter reporter)
  throws IOException {
 }
 }



Doubt in implementing TableReduce Interface

2009-07-24 Thread bharath vissapragada
Hi all,

i have implemented TableMap interface succesfully to emit Text,Text pairs
.. so now i must implement TableReduce interface to receive those
Text,Text pairs correspondingly ...  Is the following code correct

public class MyTableReduce
extends MapReduceBase
implements TableReduceText, Text {

 public void reduce(Text key, IteratorText values,
  OutputCollectorImmutableBytesWritable, BatchUpdate output,
  @SuppressWarnings(unused) Reporter reporter)
  throws IOException {
}
}