• <legend id='1QdgV'><style id='1QdgV'><dir id='1QdgV'><q id='1QdgV'></q></dir></style></legend>
    <tfoot id='1QdgV'></tfoot>

      <bdo id='1QdgV'></bdo><ul id='1QdgV'></ul>

    <small id='1QdgV'></small><noframes id='1QdgV'>

      <i id='1QdgV'><tr id='1QdgV'><dt id='1QdgV'><q id='1QdgV'><span id='1QdgV'><b id='1QdgV'><form id='1QdgV'><ins id='1QdgV'></ins><ul id='1QdgV'></ul><sub id='1QdgV'></sub></form><legend id='1QdgV'></legend><bdo id='1QdgV'><pre id='1QdgV'><center id='1QdgV'></center></pre></bdo></b><th id='1QdgV'></th></span></q></dt></tr></i><div id='1QdgV'><tfoot id='1QdgV'></tfoot><dl id='1QdgV'><fieldset id='1QdgV'></fieldset></dl></div>

      1. 不推荐使用 MapReduceBase 和 Mapper

        时间:2023-09-26
        <legend id='lOPbW'><style id='lOPbW'><dir id='lOPbW'><q id='lOPbW'></q></dir></style></legend>

              <tbody id='lOPbW'></tbody>
          • <tfoot id='lOPbW'></tfoot>

              <small id='lOPbW'></small><noframes id='lOPbW'>

              <i id='lOPbW'><tr id='lOPbW'><dt id='lOPbW'><q id='lOPbW'><span id='lOPbW'><b id='lOPbW'><form id='lOPbW'><ins id='lOPbW'></ins><ul id='lOPbW'></ul><sub id='lOPbW'></sub></form><legend id='lOPbW'></legend><bdo id='lOPbW'><pre id='lOPbW'><center id='lOPbW'></center></pre></bdo></b><th id='lOPbW'></th></span></q></dt></tr></i><div id='lOPbW'><tfoot id='lOPbW'></tfoot><dl id='lOPbW'><fieldset id='lOPbW'></fieldset></dl></div>
                <bdo id='lOPbW'></bdo><ul id='lOPbW'></ul>
                1. 本文介绍了不推荐使用 MapReduceBase 和 Mapper的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  public static class Map extends MapReduceBase implements Mapper
                  

                  MapReduceBaseMapperJobConfHadoop 0.20.203 中已弃用.

                  MapReduceBase, Mapper and JobConf are deprecated in Hadoop 0.20.203.

                  我们现在应该使用什么?

                  What should we use now?

                  Edit 1 - 对于 MapperMapReduceBase,我发现我们只需要扩展 Mapper

                  Edit 1 - for the Mapper and the MapReduceBase, I found that we just need to extends the Mapper

                  public static class Map extends Mapper
                              <LongWritable, Text, Text, IntWritable> {
                    private final static IntWritable one = new IntWritable(1);
                    private Text word = new Text();
                  
                    public void map(LongWritable key, Text value, 
                           OutputCollector<Text, IntWritable> output, 
                           Reporter reporter) throws IOException {
                      String line = value.toString();
                      StringTokenizer tokenizer = new StringTokenizer(line);
                      while (tokenizer.hasMoreTokens()) {
                        word.set(tokenizer.nextToken());
                        output.collect(word, one);
                      }
                    }
                  }
                  

                  Edit 2 - 对于 JobConf 我们应该使用如下配置:

                  Edit 2 - For JobConf we should use configuration like this:

                  public static void main(String[] args) throws Exception {
                          Configuration conf = new Configuration();
                          Job job = new Job(conf);
                          job.setMapperClass(WordCount.Map.class);
                      }
                  

                  编辑 3 - 我根据新 API 找到了一个很好的教程:http://sonerbalkir.blogspot.com/2010/01/new-hadoop-api-020x.html

                  Edit 3 - I found a good tutorial according to the new API : http://sonerbalkir.blogspot.com/2010/01/new-hadoop-api-020x.html

                  推荐答案

                  Javadoc 包含信息在这个过时的类中使用什么:

                  Javadoc contains info what to use instaed of this depraceated classes:

                  例如http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/mapred/JobConf.html

                   Deprecated. Use Configuration instead
                  

                  当你使用 maven 和开放类声明 (F3) 时,maven 可以自动下载源代码,你会看到带有解释的 javadoc 注释内容.

                  When you use maven and open class declaration (F3) maven can automatically download source code and you'll see content of javadoc comments with explanations.

                  这篇关于不推荐使用 MapReduceBase 和 Mapper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:简单的 Java Map/Reduce 框架 下一篇:为什么将 Mapper 和 Reducer 类声明为静态的?

                  相关文章

                  最新文章

                2. <legend id='0gV0R'><style id='0gV0R'><dir id='0gV0R'><q id='0gV0R'></q></dir></style></legend>

                  <small id='0gV0R'></small><noframes id='0gV0R'>

                  1. <tfoot id='0gV0R'></tfoot>
                  2. <i id='0gV0R'><tr id='0gV0R'><dt id='0gV0R'><q id='0gV0R'><span id='0gV0R'><b id='0gV0R'><form id='0gV0R'><ins id='0gV0R'></ins><ul id='0gV0R'></ul><sub id='0gV0R'></sub></form><legend id='0gV0R'></legend><bdo id='0gV0R'><pre id='0gV0R'><center id='0gV0R'></center></pre></bdo></b><th id='0gV0R'></th></span></q></dt></tr></i><div id='0gV0R'><tfoot id='0gV0R'></tfoot><dl id='0gV0R'><fieldset id='0gV0R'></fieldset></dl></div>
                    • <bdo id='0gV0R'></bdo><ul id='0gV0R'></ul>