2 つのステップで構成される mapreduce チェーンを作成しようとしています。最初の reduce はキーと値のペアを (key, value) として出力します。value はカスタム オブジェクトのリストであり、2 番目のマッパーは最初の reducer の出力を読み取る必要があります。リストはカスタム ArrayWritable です。関連するコードは次のとおりです。
class MyArrayWritable extends ArrayWritable {
public MyArrayWritable() {
super(Custom.class);
}
public MyArrayWritable(Writable[] values) {
super(Custom.class, values);
}
@Override
public Custom[] get() {
return (Custom[]) super.get();
}
@Override
public String toString() {
return Arrays.toString(get());
}
@Override
public void write(DataOutput arg0) throws IOException {
super.write(arg0);
}
}
2 番目のマッパー (カスタム arraywritable を値として取得):
public static class SecondMapper extends Mapper<Text, MyArrayWritable, Text, IntWritable> {
public void map(Text key, MyArrayWritable value, Context context) throws IOException, InterruptedException {
//other code
context.write(key, myNewWritableArray);
}
}
2 番目のジョブが開始されると、次のエラーが発生します: Error: java.lang.RuntimeException: java.lang.NoSuchMethodException: Detector$MyArrayWritable.< init >()
どうすれば解決できますか?MyArrayWritable 内にデフォルトのコンストラクターを既に実装しています