コード例 #1
0
 public static void verifyMapReduce(
     SmartMapper mapper, SmartReducer reducer, Object key, Object input) throws Exception {
   MapDriver mapDriver = new MapDriver();
   mapDriver.setMapper(mapper);
   MapReduceDriver mapReduceDriver = new MapReduceDriver();
   mapReduceDriver.setMapper(mapper);
   Object writableKey = createWritable(key, mapper.getKeyInType());
   Object writableValue = createWritable(input, mapper.getValueInType());
   mapDriver.withInput(writableKey, writableValue);
   List results = mapDriver.run();
   Collections.sort(results, PairComparer.INSTANCE);
   mapReduceDriver =
       new MapReduceDriver<LongWritable, Text, Text, LongWritable, Text, LongWritable>();
   writableKey = createWritable(key, mapper.getKeyInType());
   writableValue = createWritable(input, mapper.getValueInType());
   mapReduceDriver.withInput(writableKey, writableValue);
   mapReduceDriver.setMapper(mapper);
   mapReduceDriver.setReducer(reducer);
   List finalResults = mapReduceDriver.run();
   String text =
       String.format(
           "[%s]\r\n\r\n -> maps via %s to -> \r\n\r\n%s\r\n\r\n -> reduces via %s to -> \r\n\r\n%s",
           input,
           mapper.getClass().getSimpleName(),
           ArrayUtils.toString(results, Echo.INSTANCE),
           reducer.getClass().getSimpleName(),
           ArrayUtils.toString(finalResults, Echo.INSTANCE));
   Approvals.verify(text);
 }
 public void setUp() {
   mapReduceDriver =
       new MapReduceDriver<
           NullWritable, FaunusVertex, LongWritable, Holder, NullWritable, FaunusVertex>();
   mapReduceDriver.setMapper(new BackFilterMapReduce.Map());
   mapReduceDriver.setCombiner(new BackFilterMapReduce.Combiner());
   mapReduceDriver.setReducer(new BackFilterMapReduce.Reduce());
 }
 public void setUp() {
   mapReduceDriver =
       new MapReduceDriver<
           NullWritable, FaunusVertex, NullWritable, FaunusVertex, NullWritable, FaunusVertex>();
   mapReduceDriver.setMapper(new IntervalFilterMap.Map());
   mapReduceDriver.setReducer(
       new Reducer<NullWritable, FaunusVertex, NullWritable, FaunusVertex>());
 }
 @Before
 public void setUp() {
   AudioQASettings.MAPPER_OUTPUT_DIR = "output/MigrateMp3ToWav/";
   MigrationMapper mapper = new MigrationMapper();
   MigrateMp3ToWav.MigrationReducer reducer = new MigrateMp3ToWav.MigrationReducer();
   mapDriver = new MapDriver<LongWritable, Text, LongWritable, Text>();
   mapDriver.setMapper(mapper);
   reduceDriver = new ReduceDriver<LongWritable, Text, LongWritable, Text>();
   reduceDriver.setReducer(reducer);
   mapReduceDriver =
       new MapReduceDriver<LongWritable, Text, LongWritable, Text, LongWritable, Text>();
   mapReduceDriver.setMapper(mapper);
   mapReduceDriver.setReducer(reducer);
 }
コード例 #5
0
  @Before
  public void setup() {
    mrPageVisitor =
        new MapReduceDriver<
            LongWritable,
            VisitLogEntry,
            PageVisitKey,
            PageVisitValue,
            PageVisitKey,
            PageVisitOutputValue>();

    mrPageVisitor.setMapper(new PageVisitMapReduce.PageVisitMapper());
    mrPageVisitor.setReducer(new PageVisitMapReduce.PageVisitReducer());
  }