org.apache.hadoop.zebra.mapreduce.BasicTableOutputFormat
the tuple object for reuse. Tuple outRow; // indices of various fields in the output Tuple. int idxName, idxAge, idxSalary, idxBonusPct; @Override public void configure(Job job) { Schema outSchema = BasicTableOutputFormat.getSchema(job); // create a tuple that conforms to the output schema. outRow = TypesUtils.createTuple(outSchema); // determine the field indices. idxName = outSchema.getColumnIndex("Name"); idxAge = outSchema.getColumnIndex("Age"); idxSalary = outSchema.getColumnIndex("Salary"); idxBonusPct = outSchema.getColumnIndex("BonusPct"); } @Override public void reduce(K key, Iterator<V> values, OutputCollector<BytesWritable, Tuple> output, Reporter reporter) throws IOException { String name; int age; int salary; double bonusPct; // ... Determine the value of the individual fields of the row to be inserted. try { outTuple.set(idxName, name); outTuple.set(idxAge, new Integer(age)); outTuple.set(idxSalary, new Integer(salary)); outTuple.set(idxBonusPct, new Double(bonusPct)); output.collect(new BytesWritable(name.getBytes()), outTuple); } catch (ExecException e) { // should never happen } } @Override public void close() throws IOException { // no-op } }