Java 类org.apache.hadoop.mapred.lib.MultipleTextOutputFormat 实例源码

项目:hops    文件:TestMultipleTextOutputFormat.java   
private static void test2(JobConf job) throws IOException {
  FileSystem fs = FileSystem.getLocal(job);
  String name = "part-00000";
  //pretend that we have input file with 1/2/3 as the suffix
  job.set(JobContext.MAP_INPUT_FILE, "1/2/3");
  // we use the last two legs of the input file as the output file
  job.set("mapred.outputformat.numOfTrailingLegs", "2");
  MultipleTextOutputFormat<Text, Text> theOutputFormat = new MultipleTextOutputFormat<Text, Text>();
  RecordWriter<Text, Text> rw = theOutputFormat.getRecordWriter(fs, job, name, null);
  writeData(rw);
  rw.close(null);
}