我无法编译MapReduceSpecification.of。当我选择时,它确实有效 //新的DatastoreOutput(1)), 但需要新的GoogleCloudStorageFileOutput(" images.sb.a-cti.com/staging/test"," result.txt"," text / plain",1 )),. 这显示编译错误不确定我是否遗漏了一些东西。
我尝试用不同的Marshallers替换,但结果是一样的。
有人可以对此有所了解。
@RequestMapping("/accountJDOCounter")
public void accountJDOCounter(HttpServletRequest request, HttpServletResponse response){
try{
String entityClassName = request.getParameter("entityClassName");
String entityKind = request.getParameter("entityKind");
if(entityKind == null){
response.getWriter().write("Error");
return;
}
MapReduceSettings settings = new MapReduceSettings().setWorkerQueueName("default").setControllerQueueName("default").setBuck etName("images.sb.a-cti.com/staging/test");
logger.info("Creating job15");
String jobId = MapReduceJob.start(
MapReduceSpecification.of(
"AccountJDO",
new DatastoreInput(entityKind, 10),
new AccountCounterMapper(),
Marshallers.getStringMarshaller(),
Marshallers.getLongMarshaller(),
new AccountCounterReducer(),
//new InMemoryOutput<KeyValue<String, Long>>(2)),
new GoogleCloudStorageFileOutput("images.sb.a-cti.com/staging/test", "result.txt", "text/plain", 1)),
//new DatastoreOutput(1)),
settings);
// jobId is used to monitor, see step 5) below
response.getWriter().write("jobId " + jobId);
logger.info("JobId " + jobId);
}catch(Exception e){
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
logger.info("Error " + sw.toString());
}
}
错误详情: 此行有多个标记
适用于参数(String,DatastoreInput,AccountCounterMapper,Marshaller,Marshaller,AccountCounterReducer,
InMemoryOutput&GT)
适用于参数(String,DatastoreInput,AccountCounterMapper,Marshaller,Marshaller,AccountCounterReducer,
GoogleCloudStorageFileOutput)
提前致谢。
答案 0 :(得分:0)
签名中的泛型需要匹配。当DatastoreOutput获取实体时,GoogleCloudStorageFileOutput将使用ByteBuffer。因此,根据AccountCounterReducer发出的类型,您需要选择与该类型匹配的输出。