我正在使用 KeyValueTextInputFormat 读取/处理逗号分隔的文件:
100,56
89,586
123,68
但是我得到了键中的所有值,值字段为空,即使在将分隔符指定为逗号(,)之后也是如此。它没有选择分隔符,不确定是什么问题,这是我的驱动程序代码:
Configuration conf = new Configuration();
conf.set("key.value.separator.in.input.line", ",");
Job job = new Job(conf, "citation data");
job.setJarByClass(Citation.class);
job.setJobName("citation data");
job.setMapperClass(MapClass.class);
job.setReducerClass(ReduceClass.class);
job.setInputFormatClass(KeyValueTextInputFormat.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
KeyValueTextInputFormat.addInputPath(job, new Path("input/sample.txt"));
FileOutputFormat.setOutputPath(job, new Path("output2"));
System.exit(job.waitForCompletion(true)?0:1);