salmanbw
salmanbw

Reputation: 1311

MultipleOutputs to be of different FileOutputFormat

I am trying to write Multiple output files using MultipleOutputs. Howevere i want my FileOutputFormat to be of two different format i.e. Text and SequenceFileFormat for different files. Is there any way i can achieve this ?

Upvotes: 0

Views: 59

Answers (1)

Venkat
Venkat

Reputation: 1810

Refer to the following Link: MultipleOutputs

Use the method : addNamedOutput

public static void addNamedOutput(Job job,
              String namedOutput,
              Class<? extends OutputFormat> outputFormatClass,
              Class<?> keyClass,
              Class<?> valueClass)

So essentially your code would look like :

MultipleOutputs.addNamedOutput(job, "Output1", SequenceFileOutputFormat.class, Text.class, Text.class);
 MultipleOutputs.addNamedOutput(job, "Output1", TextOutputFormat.class, NullWritable.class, Text.class);

HTH.

Upvotes: 1

Related Questions