重写以简化。为什么会这样编译:
MapReduceSpecification.of(
"Something, anything",
input,
mapper, // (extends Mapper<Job, Long, String>)
Marshallers.getLongMarshaller(),
Marshallers.getStringMarshaller(),
NoReducer.<Long, String, String>create(),
NoOutput.<String, String>create((int)1L)
);
但事实并非如此。注意评论中不同的“映射器”扩展:
MapReduceSpecification.of(
"Something, anything",
input,
mapper, // (extends Mapper<Job, Long, JobSummary>)
Marshallers.getLongMarshaller(),
Marshallers.getSerializationMarshaller(),
NoReducer.<Long, JobSummary, JobSummary>create(),
NoOutput.<JobSummary, JobSummary>create((int)1L)
);
抛出此编译异常:
The method
of(String,
Input<I>,
Mapper<I,K,V>,
Marshaller<K>,
Marshaller<V>,
Reducer<K,V,O>, Output<O,R>)
in the type MapReduceSpecification is not applicable for the arguments
(String,
JobInput,
JobMapper,
Marshaller<Long>,
Marshaller<Serializable>,
NoReducer<Long,JobSummary,JobSummary>,
NoOutput<JobSummary,JobSummary>)
JobSummary 很简单(出于本示例的目的):
public class JobSummary implements Serializable {
public String Text;
}
任何关于我错过了 I、K、V、O、R 的神秘组合的任何见解?