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

      <legend id='zNLtp'><style id='zNLtp'><dir id='zNLtp'><q id='zNLtp'></q></dir></style></legend>
        <bdo id='zNLtp'></bdo><ul id='zNLtp'></ul>
    1. <tfoot id='zNLtp'></tfoot>

        hadoop映射器中对象类型的键

        时间:2023-09-27
          <tbody id='Zr2eY'></tbody>
        <i id='Zr2eY'><tr id='Zr2eY'><dt id='Zr2eY'><q id='Zr2eY'><span id='Zr2eY'><b id='Zr2eY'><form id='Zr2eY'><ins id='Zr2eY'></ins><ul id='Zr2eY'></ul><sub id='Zr2eY'></sub></form><legend id='Zr2eY'></legend><bdo id='Zr2eY'><pre id='Zr2eY'><center id='Zr2eY'></center></pre></bdo></b><th id='Zr2eY'></th></span></q></dt></tr></i><div id='Zr2eY'><tfoot id='Zr2eY'></tfoot><dl id='Zr2eY'><fieldset id='Zr2eY'></fieldset></dl></div>

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

            <bdo id='Zr2eY'></bdo><ul id='Zr2eY'></ul>

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

                • 本文介绍了hadoop映射器中对象类型的键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  hadoop 新手并尝试从 这里.

                  New to hadoop and trying to understand the mapreduce wordcount example code from here.

                  文档中的映射器是 -

                  The mapper from documentation is -

                  Mapper<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
                  

                  我看到在mapreduce字数示例中,地图代码如下

                  I see that in the mapreduce word count example the map code is as follows

                  public void map(Object key, Text value, Context context)
                  

                  问题 - 这个 Object 类型的键有什么意义?如果映射器的输入是文本文档,我假设其中的值是 hadoop 已分区并存储在 HDFS 中的文本块(64MB 或 128MB).更一般地说,这个输入键键入地图代码有什么用?

                  Question - What is the point of this key of type Object? If the input to a mapper is a text document I am assuming the value in would be the chunk of text (64MB or 128MB) that hadoop has partitioned and stored in HDFS. More generally, what is the use of this input key Keyin to the map code?

                  任何指针将不胜感激

                  推荐答案

                  InputFormat 描述了 Map-Reduce 作业的输入规范.默认情况下,hadoop 使用 TextInputFormat,它继承了 FileInputFormat,处理输入文件.

                  InputFormat describes the input-specification for a Map-Reduce job.By default, hadoop uses TextInputFormat, which inherits FileInputFormat, to process the input files.

                  我们还可以指定在客户端或驱动代码中使用的输入格式:

                  We can also specify the input format to use in the client or driver code:

                  job.setInputFormatClass(SomeInputFormat.class);
                  

                  对于 TextInputFormat,文件被分成几行.键是文件中的位置,值是文本行.

                  For the TextInputFormat, files are broken into lines. Keys are the position in the file, and values are the line of text.

                  public void map(Object key, Text value, Context context)中,key是行偏移,value 是实际的文本.

                  In the public void map(Object key, Text value, Context context) , key is the line offset and value is the actual text.

                  请查看 TextInputFormat API https://hadoop.apache.org/docs/current/api/org/apache/hadoop/mapreduce/lib/input/TextInputFormat.html

                  Please look at TextInputFormat API https://hadoop.apache.org/docs/current/api/org/apache/hadoop/mapreduce/lib/input/TextInputFormat.html

                  默认情况下,对于 TextInputFormat,Key 是 LongWritable 类型,值是 Text 类型.在您的示例中,Object 类型在LongWritable 的位置,因为它是兼容的.您也可以使用 LongWritable 类型代替 Object

                  By default, Key is LongWritable type and value is of type Text for the TextInputFormat.In your example, Object type is specified in the place of LongWritable as it is compatible. You can also use LongWritable type in the place of Object

                  这篇关于hadoop映射器中对象类型的键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 下一篇:Hadoop mapReduce 如何在 HDFS 中仅存储值

                  相关文章

                  最新文章

                  <tfoot id='WcuJw'></tfoot>
                  • <bdo id='WcuJw'></bdo><ul id='WcuJw'></ul>
                • <small id='WcuJw'></small><noframes id='WcuJw'>

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

                      <legend id='WcuJw'><style id='WcuJw'><dir id='WcuJw'><q id='WcuJw'></q></dir></style></legend>