When you write a mapreduce program, the data that is passed between map and reduce needs to be ArrayList type, and you encounter one of these errors during debugging run:
Java.lang.runtimeexception:java.lang.nosuchmethodexception:org.apache.hadoop.io.arraywritable.<init> ()
After querying the official website API document to discover such a passage:
A writable for arrays containing instances of a class. The elements of this writable must all is instances of the same class. If This writable'll be is the input for a reducer, you'll need to create a subclass that sets the value of the prop ER type. For Example:public class Intarraywritable extends Arraywritable {public intarraywritable () {super (intwritable.class);} }
The original is to implement a arraywritable class of derived classes, when used as long as the implementation of two constructors can
public static class Textarraywritable extends Arraywritable {public
textarraywritable () {
super (Text.class); c3/>} public
textarraywritable (string[] strings) {
super (text.class);
text[] Texts = new Text[strings.length];
for (int i = 0; i < strings.length i++) {
texts[i] = new Text (strings[i));
Set (texts);
}