hadoop-hdfs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sahil Agarwal <sahil.agar...@xoom.com>
Subject Re: How to write the contents from mapper into file
Date Wed, 13 Nov 2013 17:50:59 GMT
I’m not sure if it’s best way, but if all you’re looking for is the contents produced
from the mapper, you could have a reducer function that just returns the data from the mapper
unmodified.

-Sahil

From: unmesha sreeveni <unmeshabiju@gmail.com<mailto:unmeshabiju@gmail.com>>
Reply-To: "user@hadoop.apache.org<mailto:user@hadoop.apache.org>" <user@hadoop.apache.org<mailto:user@hadoop.apache.org>>
Date: Tuesday, November 12, 2013 at 9:51 PM
To: User Hadoop <user@hadoop.apache.org<mailto:user@hadoop.apache.org>>
Subject: How to write the contents from mapper into file

How to write the contents of mapper into file. Is this fine.

If my inputfile is splited whether my blw code works?

In reducer i am combining this data.


public class MyMapper extends
Mapper<Object, Text, Text, MatrixWritable > {
public void map(Object key, Text value, Context context)
throws IOException, InterruptedException {
 Configuration conf = new Configuration();
  FileSystem fs = FileSystem.get(conf);

  Path inputfile = new Path("in/map");
  BufferedWriter getdatabuffer = new BufferedWriter(new OutputStreamWriter(fs.create(inputfile)));
  if(value.toString()!= null){
     getdatabuffer.write(value.toString());
    }
    getdatabuffer.close();

--
Thanks & Regards

Unmesha Sreeveni U.B
Junior Developer




---------------------------------------------------------------------------------
The information transmitted in this email is intended only for the person or entity to which
it is addressed, and may contain material confidential to Xoom Corporation, and/or its subsidiary,
buyindiaonline.com Inc.  Any review, retransmission, dissemination or other use of, or taking
of any action in reliance upon, this information by persons or entities other than the intended
recipient(s) is prohibited.   If you received this email in error, please contact the sender
and delete the material from your files.

Mime
View raw message