Hadoop MapReduce Framework에서 Java 구현 프로그램을 작성 중입니다. 그리고 저는 CombinePatternReduce.class
이라는 명칭을 쓰고 있습니다.Hadoop의 감속기 MapReduce Java 구현
@SuppressWarnings("unchecked")
public static void main(String[] args) throws IOException, InterruptedException{
Text key = new Text("key2:::key1:::_ performs better than _");
IntWritable count5 = new IntWritable(5);
IntWritable count3 = new IntWritable(3);
IntWritable count8 = new IntWritable(8);
List<IntWritable> values = new ArrayList<IntWritable>();
values.add(count5);
values.add(count3);
values.add(count8);
CombinePatternReduce reducer = new CombinePatternReduce();
Context dcontext = new DebugTools.DebugReducerContext<Text, IntWritable, KeyPairWritableComparable, WrapperDoubleOrPatternWithWeightWritable>(reducer, key, count3); // here is the problem
reducer.reduce(key, values, dcontext);
}
가 DebugTools.DebugReducerContext
내가 수행하기 위해 디버깅 과정을 쉽게를 만들기 위해 쓰기 클래스이며, 그것은 다음과 같습니다 : Eclipse에서 감속기를 디버깅하기 위해, 나는 다음과 같은 main()
함수를 작성
public static class DebugReducerContext<KIN, VIN, KOUT, VOUT> extends Reducer<KIN, VIN, KOUT, VOUT>.Context {
DebugTools dtools = new DebugTools();
DataOutput out = dtools.new DebugDataOutputStream(System.out);
public DebugReducerContext(Reducer<KIN, VIN, KOUT, VOUT> reducer, Class<KIN> keyClass, Class<VIN> valueClass) throws IOException, InterruptedException{
reducer.super(new Configuration(), new TaskAttemptID(), new DebugRawKeyValueIterator(), null, null,
null, null, null, null, keyClass, valueClass);
}
@Override
public void write(Object key, Object value) throws IOException, InterruptedException {
writeKeyValue(key, value, out);
}
@Override
public void setStatus(String status) {
System.err.println(status);
}
}
문제는 코드의 첫 번째 부분, 즉 main()
에 있습니다. 내가
Context dcontext = new DebugTools.DebugReducerContext<Text, IntWritable, KeyPairWritableComparable, WrapperDoubleOrPatternWithWeightWritable>(reducer, key, count3);
을 쓸 때
The constructor DebugTools.DebugReducerContext<Text,IntWritable,KeyPairWritableComparable,WrapperDoubleOrPatternWithWeightWritable>(CombinePatternReduce, Text, IntWritable) is undefined.
내가
The constructor DebugTools.DebugReducerContext<Text,IntWritable,KeyPairWritableComparable,WrapperDoubleOrPatternWithWeightWritable>(CombinePatternReduce, Text, List<IntWritable>) is undefined.
이 Reducer.Context
의 문서이기 때문에 것을 오류가 있습니다
Context dcontext = new DebugTools.DebugReducerContext<Text, IntWritable, KeyPairWritableComparable, WrapperDoubleOrPatternWithWeightWritable>(reducer, key, values);
작성하는 것이 오류가 있습니다
public Reducer.Context(Configuration conf,
TaskAttemptID taskid,
RawKeyValueIterator input,
Counter inputKeyCounter,
Counter inputValueCounter,
RecordWriter<KEYOUT,VALUEOUT> output,
OutputCommitter committer,
StatusReporter reporter,
RawComparator<KEYIN> comparator,
Class<KEYIN> keyClass,
Class<VALUEIN> valueClass)
throws IOException,
InterruptedException
나는 Class<KEYIN> keyClass
과 Class<VALUEIN> valueClass
A의 전달해야합니다. 그렇다면 main() 함수 (특히 오류가있는 문장)를 작성하여 감속기 클래스를 디버그 할 수 있습니까?
로직을 단위 테스트하려면 MRUnit을 사용하십시오. 입력이 있으면 localrunner를 사용하십시오. 자신 만의 컨텍스트를 작성할 필요가 없습니다. –