我想将输出分隔符更改为;而不是标签。我已经尝试过: Hadoop: key and value are tab separated in the output file. how to do it semicolon-separated? 但是我的输出ISTHadoop - 输出键/值分隔符
key (tab) value
我使用Cloudera的演示(CDH 4.1.3)。 这里是我的代码:
Configuration conf = new Configuration();
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 2) {
System.err.println("Usage: Driver <in> <out>");
System.exit(2);
}
conf.set("mapreduce.textoutputformat.separator", ";");
Path in = new Path(otherArgs[0]);
Path out = new Path(otherArgs[1]);
Job job= new Job(getConf());
job.setJobName("MapReduce");
job.setMapperClass(Mapper.class);
job.setReducerClass(Reducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.setInputPaths(job, in);
FileOutputFormat.setOutputPath(job, out);
job.setJarByClass(Driver.class);
job.waitForCompletion(true) ? 0 : 1;
我想
key;value
我的输出。
看到这个:http://www.unmeshasreeveni.blogspot.in/2014/04/can-we-change-default-key-value-output.html –