Prashanth G N
Prashanth G N

Reputation: 145

Hadoop Mapper to read key-value pairs

Is there a builtin InputFormat that I can use in a mapper function to read input lines of following format:

Name [key1#val1,key2#val2,key3#val3,key4#val4]

Sample input data may look like below:

sanjose [population#123,area#123,address#1,jkui,ty,tz#PST]
delhi [population#1823,area#1023,address#1,jkui,ty,tz#IST]
boston [population#1823,area#1023,address#1,jkui,ty,tz#EST]

Upvotes: 0

Views: 215

Answers (1)

Arun A K
Arun A K

Reputation: 2225

Set the property mapreduce.input.keyvaluelinerecordreader.key.value.separator and use job.setInputFormatClass(KeyValueTextInputFormat.class);

In your case I believe \t is the Key Value delimiter

Upvotes: 0

Related Questions