@Test
 public void testReducer() throws IOException {
   reduceDriver.withInput(
       new Text("Apr 25"),
       Arrays.asList(new LongWritable(3), new LongWritable(5), new LongWritable(9)));
   reduceDriver.withOutput(new Text("Apr 25"), new LongWritable(17));
   reduceDriver.runTest();
 }
 @Test
 public void testReducer() throws IOException {
   List<Text> values = new ArrayList<Text>();
   values.add(outputdir);
   // TODO test multiple values
   reduceDriver.withInput(new LongWritable(0), values);
   reduceDriver.withOutput(new LongWritable(0), new Text(outputdir.toString() + "\n"));
   reduceDriver.runTest();
 }
Пример #3
0
 @Test
 public void testReducer() throws IOException {
   List<IntWritable> values = new ArrayList<IntWritable>();
   values.add(new IntWritable(4028));
   values.add(new IntWritable(1024));
   reduceDriver.withInput(new Text("ip1"), values);
   reduceDriver.withOutput(new Text("ip1"), new AggregatedValue(5052, 2526));
   reduceDriver.runTest();
 }
Пример #4
0
  @Test
  public void testReducer() throws IOException {
    reducerDriver.withInput(
        new Text("Marco"),
        Arrays.asList(
            new TextPair("Fabio", "FRIENDS"),
            new TextPair("Luca", "FRIENDS"),
            new TextPair("Gordon", "FRIENDS"),
            new TextPair("Nathalia", "Fabio"),
            new TextPair("Nathalia", "Luca")));

    reducerDriver.withInput(
        new Text("Gordon"),
        Arrays.asList(
            new TextPair("Fabio", "Marco"),
            new TextPair("Marco", "FRIENDS"),
            new TextPair("Luca", "Marco")));

    reducerDriver.withInput(
        new Text("Luca"),
        Arrays.asList(
            new TextPair("Fabio", "Nathalia"),
            new TextPair("Fabio", "Marco"),
            new TextPair("Gordon", "Marco"),
            new TextPair("Nathalia", "FRIENDS"),
            new TextPair("Marco", "FRIENDS")));

    reducerDriver.withInput(
        new Text("Fabio"),
        Arrays.asList(
            new TextPair("Luca", "Marco"),
            new TextPair("Luca", "Nathalia"),
            new TextPair("Gordon", "Marco"),
            new TextPair("Nathalia", "FRIENDS"),
            new TextPair("Marco", "FRIENDS")));

    reducerDriver.withInput(
        new Text("Nathalia"),
        Arrays.asList(
            new TextPair("Marco", "Fabio"),
            new TextPair("Marco", "Luca"),
            new TextPair("Luca", "FRIENDS"),
            new TextPair("Fabio", "FRIENDS")));

    reducerDriver.withAllOutput(
        Arrays.asList(
            new Pair<>(new Text("Gordon"), new Text("Luca(1:[Marco]),Fabio(1:[Marco])")),
            new Pair<>(new Text("Luca"), new Text("Gordon(1:[Marco]),Fabio(2:[Nathalia, Marco])")),
            new Pair<>(new Text("Marco"), new Text("Nathalia(2:[Fabio, Luca])")),
            new Pair<>(new Text("Fabio"), new Text("Gordon(1:[Marco]),Luca(2:[Marco, Nathalia])")),
            new Pair<>(new Text("Nathalia"), new Text("Marco(2:[Fabio, Luca])"))));

    reducerDriver.runTest(false);
  }
  @Test
  public void testReducer() throws IOException, InterruptedException {
    ReduceDriver<IntTriple, IntVector1, IntWritable, IntVector> driver =
        new ReduceDriver<IntTriple, IntVector1, IntWritable, IntVector>();
    driver.withReducer(new MatrixReducer());

    IntWritable[] a = {
      new IntWritable(1), new IntWritable(1), new IntWritable(3), new IntWritable(1)
    };
    IntWritable[] b1 = {
      new IntWritable(2), new IntWritable(1), new IntWritable(3), new IntWritable(1)
    };
    IntWritable[] b2 = {
      new IntWritable(1),
      new IntWritable(1),
      new IntWritable(2),
      new IntWritable(1),
      new IntWritable(3),
      new IntWritable(1)
    };
    IntWritable[] b3 = {new IntWritable(1), new IntWritable(1)};
    driver.addInput(
        new IntTriple(1, 2, 1),
        Arrays.asList(
            new IntVector1(new ArrayWritable(IntWritable.class, a), new IntWritable(-1)),
            new IntVector1(new ArrayWritable(IntWritable.class, b1), new IntWritable(1)),
            new IntVector1(new ArrayWritable(IntWritable.class, b2), new IntWritable(2)),
            new IntVector1(new ArrayWritable(IntWritable.class, b3), new IntWritable(3))));
    IntWritable[] c = {
      new IntWritable(1),
      new IntWritable(1),
      new IntWritable(2),
      new IntWritable(1),
      new IntWritable(3),
      new IntWritable(1)
    };
    driver.addOutput(new IntWritable(1), new IntVector(new ArrayWritable(IntWritable.class, c)));
    driver.runTest();
  }