Google App Engine MapReduceSpecification exception



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

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

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

相关内容

  • 没有找到相关文章

最新更新