You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mrunit.apache.org by David Gevorkyan <da...@gmail.com> on 2014/01/16 02:13:39 UTC

Serialization issue in MRUNIT 1.0.0 release.

Hi Guys,

When using the following artifact of MRUNIT:

  <groupId>org.apache.mrunit</groupId>
  <artifactId>mrunit</artifactId>
  <version>1.0.0</version>
  <properties>
    <envClassifier>hadoop1</envClassifier>
  </properties>

I found a bug, basically that TupleWritable serialized inputs are not
working, because Copying doesn't properly work for them.

In order for me to double check that I have added a Unit test in the
*org.apache.hadoop.mrunit.internal.io.TestSerialization*.
See the code below:

@Test
    public void testTupleWritableCopyArgument() {
        final TupleWritable tupleWritable = new TupleWritable(new Text[] {
                new Text("Cg5AAVIFZW5fQ0F4AZgCAg=="),
                new Text("CAESBggCGAAgAA==")
        });

        final Serialization serialization = new Serialization(new
Configuration());
        final TupleWritable copy = serialization.copy(tupleWritable, null);

        // The equality is not properly implemented in TupleWritable
        assertEquals(tupleWritable, copy);

*        // BOTH OF THESE FAIL, since Text("") is being returned.*
*        assertEquals(tupleWritable.get(0), copy.get(0));*
*        assertEquals(tupleWritable.get(1), copy.get(1));*
    }


Note that mentioned issue is not visible in the "0.9.0-incubating" version,
since https://github.com/apache/mrunit/blob/*release-0.9.0-incubating*
/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java
addInput() method is implemented in a different manner, namely:

public void addInput(final K1 key, final V1 val) {
    *inputList.add(new Pair<K1, V1>(key, val));*
}

While https://github.com/apache/mrunit/blob/*release-1.0.0-hadoop1*
/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java
public void addInput(final K1 key, final V1 val) {
    *inputList.add(copyPair(key, val));*
}

As you can see latest release is using copyPair(), that's why serialization
issue is being revealed.


I have everything setup, however after spending an hour on this I realized
that you guys might help me easily track where the issue resides, rather
than me spending hours on that.
Please let me know what do you think and I would be more than happy to fix
it.



Sincerely,
David Gevorkyan
-eHarmony