Google App Engine MapReduceSpecification异常

时间:2013-09-04 08:04:12

标签: google-app-engine mapreduce

重写以简化。为什么编译:

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)
);

但事实并非如此。请注意注释中不同的“mapper”扩展名:

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的神秘组合中的哪一点?

1 个答案:

答案 0 :(得分:0)

使用特定于类的实现复制SerializationMarshaller似乎已经解决了它。这是一个非常不满意的解决方案,但它确实有效。