Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hadoop >> mail # user >> puzzled at the output


+
Kartashov, Andy 2012-10-02, 13:31
+
Harsh J 2012-10-02, 14:03
+
Kartashov, Andy 2012-10-02, 16:01
+
Chris Nauroth 2012-10-02, 16:52
+
Bertrand Dechoux 2012-10-02, 17:01
+
Mohamed Trad 2012-10-02, 17:35
Copy link to this message
-
Re: puzzled at the output
And a simple way to do that is actually writing a unit test, with MRunit
for exemple.

A little sample for a a full mapper-reducer test :

MapReduceDriver.newMapReduceDriver(new WordCountMapper(),new
WordCountReducer())
// given             .withInput(new LongWritable(1), new Text("word1 word2
word2 word1"))//
// then             .withOutput(new Text("word1"), new
LongWritable(2))//
.withOutput(new Text("word2"), new LongWritable(2))//
// when             .runTest();

Of course, there is also a MapDriver and a ReduceDriver. And
MRunitsupports both mapred and mapreduce packages.
So you should be able to apply it to your project.

Regards

Bertrand

On Tue, Oct 2, 2012 at 4:03 PM, Harsh J <[EMAIL PROTECTED]> wrote:

> Hi,
>
> Could you clarify your post to show what you expect your code to have
> actually printed and what it has printed?
>
> On Tue, Oct 2, 2012 at 7:01 PM, Kartashov, Andy <[EMAIL PROTECTED]>
> wrote:
> > Guys, have been stretching my head for the past couple of days.  Why are
> my
> > tags duplicated while the content they wrap around i.e.my StringBuilder sb
> > is not?
> >
> >
> >
> >
> >
> > My Reduce code is:
> >
> > while (values.hasNext()){
> >
> >     sb.append(values.next().toString());
> >
> >    }
> >
> >     output.collect(key,new Text("\n<aaa>\n"+sb.toString()+"\n</bbbb>\n"
> ));
> >
> >
> >
> > The out put:
> >
> > 2459
> >
> > <aaa>
> >
> >
> >
> > <aaa>
> >
> >         <value….
> >
> >                 …..
> >
> >                 ……
> >
> > </bbbb>
> >
> >
> >
> > </bbbb>
> >
> >
> >
> > NOTICE: This e-mail message and any attachments are confidential,
> subject to
> > copyright and may be privileged. Any unauthorized use, copying or
> disclosure
> > is prohibited. If you are not the intended recipient, please delete and
> > contact the sender immediately. Please consider the environment before
> > printing this e-mail. AVIS : le présent courriel et toute pièce jointe
> qui
> > l'accompagne sont confidentiels, protégés par le droit d'auteur et
> peuvent
> > être couverts par le secret professionnel. Toute utilisation, copie ou
> > divulgation non autorisée est interdite. Si vous n'êtes pas le
> destinataire
> > prévu de ce courriel, supprimez-le et contactez immédiatement
> l'expéditeur.
> > Veuillez penser à l'environnement avant d'imprimer le présent courriel
>
>
>
> --
> Harsh J
>

--
Bertrand Dechoux