mrunit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Francke (JIRA)" <>
Subject [jira] [Commented] (MRUNIT-13) Add support for MultipleOutputs
Date Mon, 21 Jul 2014 19:54:40 GMT


Lars Francke commented on MRUNIT-13:

I just tried again. This reproduces the issue:


import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.output.MultipleOutputs;
import org.apache.hadoop.mrunit.mapreduce.MapDriver;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

public class TestDemo {

  public void testMrunit() throws IOException {
    TestMapper mapper = new TestMapper();
    MapDriver<Text, Text, Text, Text> mapDriver = new MapDriver<Text, Text, Text,
    mapDriver.withInput(new Text("foo"), new Text("bar"))
      .withMultiOutput("foobar", new Text("foo"), new Text("bar"))

  public static class TestMapper extends Mapper<Text, Text, Text, Text> {

    private MultipleOutputs<Text, Text> mos;

    protected void setup(Context context) throws IOException, InterruptedException {
      mos = new MultipleOutputs<Text, Text>(context);

    public void map(Text key, Text value, Context context) throws IOException, InterruptedException
      mos.write("foobar", new Text("foo"), new Text("bar"));

    protected void cleanup(Context context) throws IOException, InterruptedException {


The Mapper using the MultipleOutputs format needs to be prepared otherwise the named outputs
are not known.

> Add support for MultipleOutputs
> -------------------------------
>                 Key: MRUNIT-13
>                 URL:
>             Project: MRUnit
>          Issue Type: New Feature
>            Reporter: E. Sammer
>            Assignee: Jim Donofrio
>             Fix For: 1.1.0
>         Attachments: MRUNIT-13.patch,, vcs-diff-8290140541471322425-2.patch,
> Add support to mrunit for Hadoop's MultipleOutputs.

This message was sent by Atlassian JIRA

View raw message