java - App Engine Mapreduce Java无法编译MapReduce Specification.of

标签 java google-app-engine hadoop mapreduce

我无法编译MapReduceSpecification.of。当我选择时它确实起作用
// new 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());

  }


 }

错误详情:
这行有多个标记
  • MapReduceSpecification类型的(String,Input,Mapper,Marshaller,Marshaller,Reducer,Output)方法不是

  • 适用于以下参数(字符串,数据存储区输入,AccountCounterMapper,Marshaller,Marshaller,AccountCounterReducer,

    InMemoryOutput>)
  • MapReduceSpecification类型的(String,Input,Mapper,Marshaller,Marshaller,Reducer,Output)方法不是

  • 适用于以下参数(字符串,数据存储区输入,AccountCounterMapper,Marshaller,Marshaller,AccountCounterReducer,

    GoogleCloudStorageFileOutput)

    提前致谢。

    最佳答案

    签名中的泛型需要匹配。 GoogleCloudStorageFileOutput使用ByteBuffer,而DatastoreOutput使用Entity。因此,根据AccountCounterReducer发出的类型,您需要选择与该类型匹配的输出。

    关于java - App Engine Mapreduce Java无法编译MapReduce Specification.of,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23522523/

    相关文章:

    java - Android 中有哪些不同的键盘类型?

    java - JOOQ 如果满足条件则插入

    java - 计划任务不适用于 websockets

    python - NDB 验证器 Prop 字段

    hadoop - 是否可以并行执行多个配置单元查询

    hadoop - 在单个节点上安装 PIG

    java - 将自 1904 年以来的纳秒转换为有效的 Java 日期

    java - 谷歌应用引擎: new instance with no user data

    java - 将文件复制到HDFS时,如何控制该文件驻留在哪些节点上?

    php - 无法在谷歌云上使用 PHP 连接到 mysql。没有错误弹出