Suresh_Hadoop
Suresh_Hadoop

Reputation: 147

How to write many arguments to the output file from reducer?

I have a text file as below

250788965731,20090906,200937,200909,621,SUNDAY,WEEKEND,ON-NET,MORNING,OUTGOING,VOICE,25078,PAY_AS_YOU_GO_PER_SECOND_PSB,SUCCESSFUL-RELEASEDBYSERVICE,5,0,1,6.25,635-10-104-40163. 

I'm just a beginner in hadoop.I faced the following problem.

How do i print the entire line in my output file? As far as i know only A key & A Value can be written to the output file. How to write this entire line with many arguments in my output file. Or how do i write atleast a few arguments of it in a output file?

Upvotes: 1

Views: 98

Answers (1)

Chris Gerken
Chris Gerken

Reputation: 16392

Use the TextOutputFormat and write the line as a Text writable as the key. Make the value null

context.write( new Text("your output line") , null);

Upvotes: 1

Related Questions