How to specify KeyValueTextInputFormat Separator in Hadoop-.20 api?

后端 未结 7 760
盖世英雄少女心
盖世英雄少女心 2020-12-08 05:57

In new API (apache.hadoop.mapreduce.KeyValueTextInputFormat) , how to specify separator (delimiter) other than tab(which is default) to separate key and Value.

Samp

7条回答
  •  隐瞒了意图╮
    2020-12-08 06:18

    In the newer API you should use mapreduce.input.keyvaluelinerecordreader.key.value.separator configuration property.

    Here's an example:

    Configuration conf = new Configuration();
    conf.set("mapreduce.input.keyvaluelinerecordreader.key.value.separator", ",");
    
    Job job = new Job(conf);
    job.setInputFormatClass(KeyValueTextInputFormat.class);
    // next job set-up
    

提交回复
热议问题