Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use BSONWritable instead of BSONObject for old MR api example.

  • Loading branch information...
commit 91517598deb2a6a1a9255e387e1b2afe494da9bd 1 parent d0b1d99
@mpobrien mpobrien authored
View
9 ...ry_yield/src/main/java/com/mongodb/hadoop/examples/treasury/TreasuryYieldXMLConfigV2.java
@@ -41,14 +41,13 @@
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 ) );
}
Please sign in to comment.
Something went wrong with that request. Please try again.