Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

Commit

Permalink
use BSONWritable instead of BSONObject for old MR api example.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpobrien committed May 3, 2013
1 parent d0b1d99 commit 9151759
Showing 1 changed file with 4 additions and 5 deletions.
Expand Up @@ -41,14 +41,13 @@ public class TreasuryYieldXMLConfigV2 extends Configured implements Tool{

static class TreasuryYieldMapperV2
extends MapReduceBase
implements Mapper<BSONObject, BSONObject, IntWritable, DoubleWritable> {
implements Mapper<BSONWritable, BSONWritable, IntWritable, DoubleWritable> {

@Override
public void map(BSONObject key, BSONObject value, OutputCollector<IntWritable, DoubleWritable> output, Reporter reporter) throws IOException {
System.out.println(key.toString());
final int year = ((Date)value.get("_id")).getYear() + 1900;
public void map(BSONWritable key, BSONWritable value, OutputCollector<IntWritable, DoubleWritable> output, Reporter reporter) throws IOException {
final int year = ((Date)value.getDoc().get("_id")).getYear() + 1900;
//final int year = key.getYear() + 1900;
double bid10Year = ( (Number) value.get( "bc10Year" ) ).doubleValue();
double bid10Year = ( (Number) value.getDoc().get( "bc10Year" ) ).doubleValue();
output.collect( new IntWritable( year ), new DoubleWritable( bid10Year ) );
}

Expand Down

0 comments on commit 9151759

Please sign in to comment.