我无法编译MapReduceSpecification。当我选择时,它确实有效//新DatastoreOutput (1)),但在新的情况下,GoogleCloudStorageFileOutput("images.sb.a-cti.com/staging/test", "result.txt", "text/plain", 1)),这显示编译错误不确定如果我错过了什么。
我已经尝试用不同的编组器替换,但结果是相同的。
有人能解释一下吗?
@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());
}
}
错误细节:此行有多个标记
- MapReduceSpecification类型中的(String, Input, Mapper, Marshaller, Marshaller, Reducer, Output)方法不是
适用于参数(String, DatastoreInput, AccountCounterMapper, Marshaller, Marshaller, AccountCounterReducer,
)InMemoryOutput>)
- MapReduceSpecification类型中的(String, Input, Mapper, Marshaller, Marshaller, Reducer, Output)方法不是
适用于参数(String, DatastoreInput, AccountCounterMapper, Marshaller, Marshaller, AccountCounterReducer,
)GoogleCloudStorageFileOutput)
签名中的泛型需要匹配。GoogleCloudStorageFileOutput接受一个ByteBuffer,而DatastoreOutput接受一个Entity。因此,根据AccountCounterReducer发出的类型,您需要选择与该类型匹配的输出。