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

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

        • <bdo id='HFP19'></bdo><ul id='HFP19'></ul>

        <tfoot id='HFP19'></tfoot>
      1. 如何在 Hadoop MapReduce 中将对象设置为 Map 输出的值

        时间:2023-09-26
      2. <legend id='ejhG4'><style id='ejhG4'><dir id='ejhG4'><q id='ejhG4'></q></dir></style></legend>
            <tbody id='ejhG4'></tbody>
        • <small id='ejhG4'></small><noframes id='ejhG4'>

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

              • <bdo id='ejhG4'></bdo><ul id='ejhG4'></ul>

                  本文介绍了如何在 Hadoop MapReduce 中将对象设置为 Map 输出的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在 Hadoop MapReduce 中,对于中间输出(由 map() 生成),我希望中间输出的值是以下对象.

                  In the Hadoop MapReduce, for the intermediate Output (generated by the map()), i want the Value for the Intermediate output to be the following object.

                  
                  MyObject{
                    date:Date
                    balance:Double
                  }
                  

                  我该怎么做.我应该创建自己的可写类吗?

                  How would i do this. Should i create my own Writable Class?

                  我是 MapReduce 的新手.

                  I am a newbie to MapReduce.

                  谢谢.

                  推荐答案

                  您可以编写您可以作为映射器值发出的自定义类型.但是无论你想作为值发出什么,都必须实现可写接口.你可以这样做:

                  You can write your custom type which you can emit as the mapper value. But whatever you want to emit as value, must implement the Writable Interface. You can do something like this :

                  public class MyObj implements WritableComparable<MyObj>{
                  
                      private String date;
                      private Double balance;
                  
                      public String getDate() { return date;}
                      public Double getBalance() { return balance;}
                  
                      @Override
                      public void readFields(DataInput in) throws IOException {
                  
                          //Define how you want to read the fields
                          }
                      @Override
                      public void writeFields(DataOutput out) throws IOException {
                  
                          //Define how you want to write the fields
                      }
                          .......
                          .......
                          .......
                  
                  }
                  

                  您也可以使用 Avro 序列化框架.

                  Alternatively you can make use of Avro serialization framework.

                  这篇关于如何在 Hadoop MapReduce 中将对象设置为 Map 输出的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:从 windows eclipse 运行 Mapreduce(yarn) 时出错 下一篇:线程“main"中的异常org.apache.hadoop.ipc.RemoteEx

                  相关文章

                  最新文章

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

                  1. <small id='Fmotm'></small><noframes id='Fmotm'>

                  2. <tfoot id='Fmotm'></tfoot>
                    <legend id='Fmotm'><style id='Fmotm'><dir id='Fmotm'><q id='Fmotm'></q></dir></style></legend>

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