app engine map reduce java无法编译MapReduceSpecification.of
我无法编译MapReduceSpecification.of。当我选择 //新数据存储输出(1)), 但在新的GoogleCloudStorageFileOutput(“images.sb.a-cti.com/staging/test”、“result.txt”、“text/plain”,1))的情况下。 这个显示编译错误不确定我是否遗漏了什么 我尝试用不同的封送员替换,但结果是一样的 谁能帮我解释一下吗app engine map reduce java无法编译MapReduceSpecification.of,java,google-app-engine,hadoop,mapreduce,Java,Google App Engine,Hadoop,Mapreduce,我无法编译MapReduceSpecification.of。当我选择 //新数据存储输出(1)), 但在新的GoogleCloudStorageFileOutput(“images.sb.a-cti.com/staging/test”、“result.txt”、“text/plain”,1))的情况下。 这个显示编译错误不确定我是否遗漏了什么 我尝试用不同的封送员替换,但结果是一样的 谁能帮我解释一下吗 @RequestMapping("/accountJDOCounter") publi
@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());
}
}
@RequestMapping(“/accountJDOCounter”)
public void accountJDOCounter(HttpServletRequest请求、HttpServletResponse响应){
试一试{
字符串entityClassName=request.getParameter(“entityClassName”);
字符串entityKind=request.getParameter(“entityKind”);
if(entityKind==null){
response.getWriter().write(“错误”);
返回;
}
MapReduceSettings设置=新建MapReduceSettings().setWorkerQueueName(“默认”).setControllerQueueName(“默认”).setBuck etName(“images.sb.a-cti.com/staging/test”);
logger.info(“创建作业15”);
字符串jobId=MapReduceJob.start(
地图还原(
“AccountJDO”,
新数据存储输入(entityKind,10),
新AccountCounterMapper(),
Marshallers.getStringMarshaller(),
Marshallers.getLongMarshaller(),
新AccountCounterReducer(),
//新的输入(2)),
新的GoogleCloudStorageFileOutput(“images.sb.a-cti.com/staging/test”、“result.txt”、“text/plain”,1)),
//新数据存储输出(1)),
设置);
//jobId用于监视,请参见下面的步骤5)
response.getWriter().write(“jobId”+jobId);
logger.info(“JobId”+JobId);
}捕获(例外e){
StringWriter sw=新的StringWriter();
PrintWriter pw=新的PrintWriter(sw);
e、 printStackTrace(pw);
logger.info(“错误”+sw.toString());
}
}
错误详细信息:
这条线上有多个标记
- 类型MapReduceSpecification中的(字符串、输入、映射器、封送拆收器、封送拆收器、减速器、输出)方法不正确
- 类型MapReduceSpecification中的(字符串、输入、映射器、封送拆收器、封送拆收器、减速器、输出)方法不正确
提前感谢。签名中的泛型需要匹配。GoogleCloudStorageFileOutput采用ByteBuffer,而DatastoreOutput采用实体。因此,根据AccountCounterReducer发出的类型,您需要选择与该类型匹配的输出。谢谢@tkaitchuck。getContext().emit(ByteBuffer.wrap(writeValue.getBytes());对我来说很好。