hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dinesh shan <cdine...@gmail.com>
Subject Creating a File From Reducer
Date Thu, 24 Mar 2011 12:19:29 GMT
Hi all ,

I am a beginner to hadoop .
I am passing a FileName as the Key and the Contents of he FIle as the Value
I want to write the contents of the FIle to a text file with Key as the
fileName,  from the reducer .
The approach that i used is

public static class myjobReducer extends Reducer<Text,Text,Text,Text>
        FileOutputStream out;
        Text tex=new Text();
        public void reduce(Text key,Iterable <Text> values,Context
context)throws IOException, InterruptedException

            String str=key.toString();

            out = new FileOutputStream(str);
            PrintStream p = new PrintStream( out );

            for(Text value:values)
                context.write(tex,tex);//Not Necessary



I am not able to create the file as specified though i set the output path

 FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));

PLease through some light
Dinesh Shaan

View raw message