1

マッパーのみがあり、リデューサーが設定されていない mapreduce プログラムがあります。これをテストしたい。私は以下のテストコードを持っています

@Test
    public void testMapper() throws IOException {

      mapDriver.withInput(new LongWritable(0l), new Text(
              "af00bac654249b9d27982f19064338f4,54.0258822077885,-1.56832133466378,20121022,105507,026542913532,2093,87"));
      mapDriver.withOutput(null, [some value]);
      mapDriver.runTest();
    }

mapDriver.withOutput(null, [some value]); の呼び出しで この行は例外の下にスローされています

java.lang.NullPointerException at org.apache.hadoop.mrunit.internal.io.Serialization.copy(Serialization.java:58) at org.apache.hadoop.mrunit.internal.io.Serialization.copy(Serialization.java:91) ) org.apache.hadoop.mrunit.internal.io.Serialization.copyWithConf(Serialization.java:104) で

Note: Mapper Generic Signature Mapper<LongWritable, Text, Void, GenericRecord>

null を出力するマッパーのテストシナリオの書き方を教えてください。

Nullwritable.get を実行すると、org.apache.hadoop.mrunit. internal.io.Serialization.copy(Serialization.java:91) の org.apache.hadoop.mrunit.internal.io.Serialization.copyWithConf(Serialization.java:104) の org.apache.hadoop.mrunit.TestDriver.copy( TestDriver.java:608) org.apache.hadoop.mrunit.TestDriver.copyPair(TestDriver.java:612) org.apache.hadoop.mrunit.TestDriver.addOutput(TestDriver.java:118) org.apache.hadoop .mrunit.TestDriver.withOutput(TestDriver.java:138) at com.gfk.gxl.etl.common.ExtractCSVTest.testMapper(ExtractCSVTest.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(ネイティブ メソッド)

シリアライゼーションで Avro NullPointerException を使用した MRUnitのように見えます が、答えは私の問題を解決していません

 with few more research i have below update
    class org.apache.avro.generic.GenericData$Record is not able to get serializer and deserializer
    in org.apache.hadoop.mrunit.internal.io.Serialization and both are coming as null which is causing the null pointer exception



 From API code snippet  for org.apache.hadoop.mrunit.internal.io.Serialization starting at line      no 61 to 70

  try {
      serializer = (Serializer<Object>) serializationFactory
          .getSerializer(clazz);
      deserializer = (Deserializer<Object>) serializationFactory
          .getDeserializer(clazz);
    } catch (NullPointerException e) {
      throw new IllegalStateException(
          "No applicable class implementing Serialization in conf at io.serializations for "
              + orig.getClass(), e);
    }
above method serializer \ deserializer  are coming null . do we have some way to avoid it
4

2 に答える 2