Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hadoop 在您的实现中是否有人重写了Mapper运行(上下文)方法?_Hadoop_Mapper - Fatal编程技术网

Hadoop 在您的实现中是否有人重写了Mapper运行(上下文)方法?

Hadoop 在您的实现中是否有人重写了Mapper运行(上下文)方法?,hadoop,mapper,Hadoop,Mapper,运行(上下文)org.apache.hadoop.mapreduce.Mapper的方法 a). Expert users can override this method for more complete control over the execution of the Mapper. 当前,run(Context)方法的默认行为是什么 如果我覆盖运行(上下文),根据文档,将获得什么样的特殊控件 在您的实现中是否有人重写了此方法 当前,run(Context)方法的默认行为是什么 默认实

运行(上下文)org.apache.hadoop.mapreduce.Mapper的方法

a). Expert users can override this method for more complete control over the execution of the Mapper.
  • 当前,run(Context)方法的默认行为是什么

  • 如果我覆盖运行(上下文),根据文档,将获得什么样的特殊控件

  • 在您的实现中是否有人重写了此方法

  • 当前,run(Context)方法的默认行为是什么
  • 默认实现在类的Apache Hadoop源代码中可见:

    总结如下:

  • 调用
    setup
    进行一次性初始化
  • 迭代输入中的所有键值对
  • 将键和值传递给
    映射
    方法实现
  • 调用
    cleanup
    进行一次性拆卸
  • 如果我重写run(Context),根据文档会得到什么样的特殊控件
  • 默认实现始终遵循单个线程中的特定执行序列。覆盖这一点是很少见的,但它可能为高度专业化的实现提供了可能性,例如不同的线程模型或尝试合并冗余的密钥范围

  • 在您的实现中是否有人重写了此方法
  • 在Apache Hadoop代码库中,有两种覆盖:

    • 允许将多个
      映射器
      类实现链接在一起,以便在单个映射任务中执行。
      run
      的覆盖设置一个表示链的对象,并通过映射器链传递每个输入键/值对
    • 允许多线程执行另一个
      Mapper
      类。映射器类必须是线程安全的。
      run
      的覆盖将启动多个线程,迭代输入键值对,并将它们传递给底层的
      Mapper
    /**
     * Expert users can override this method for more complete control over the
     * execution of the Mapper.
     * @param context
     * @throws IOException
     */
    public void run(Context context) throws IOException, InterruptedException {
      setup(context);
      try {
        while (context.nextKeyValue()) {
          map(context.getCurrentKey(), context.getCurrentValue(), context);
        }
      } finally {
        cleanup(context);
      }
    }