You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Jay Vyas <ja...@gmail.com> on 2012/07/14 02:30:00 UTC

Simply reading small a hadoop text file.

Hi guys : Whats the idiomatic way to iterate through the k/v pairs in a
text file ? been playing with almost everything everything with
SequenceFiles and almost forgot :)

my text output actually has tabs in it... So, im not sure what the default
separator is, and wehter or not there is a smart way to find the value.

-- 
Jay Vyas
MMSB/UCHC

Re: Simply reading small a hadoop text file.

Posted by Harsh J <ha...@cloudera.com>.
You want the KeyValueTextInputFormat instead of TextInputFormat. It
has its default separator as tab, so you do not need to configure the
delimiter.

However, in case you do have to change the delimiter byte, use the
config: "mapreduce.input.keyvaluelinerecordreader.key.value.separator"

For more, see http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/mapred/KeyValueTextInputFormat.html

On Sat, Jul 14, 2012 at 6:00 AM, Jay Vyas <ja...@gmail.com> wrote:
> Hi guys : Whats the idiomatic way to iterate through the k/v pairs in a
> text file ? been playing with almost everything everything with
> SequenceFiles and almost forgot :)
>
> my text output actually has tabs in it... So, im not sure what the default
> separator is, and wehter or not there is a smart way to find the value.
>
> --
> Jay Vyas
> MMSB/UCHC



-- 
Harsh J

Re: Simply reading small a hadoop text file.

Posted by Serge Blazhiyevskyy <Se...@nice.com>.
The tab is default separated

And text file is the default input format

Just simple map -reduce job will do it

Regards,
Serge

On 7/13/12 5:30 PM, "Jay Vyas" <ja...@gmail.com> wrote:

>Hi guys : Whats the idiomatic way to iterate through the k/v pairs in a
>text file ? been playing with almost everything everything with
>SequenceFiles and almost forgot :)
>
>my text output actually has tabs in it... So, im not sure what the default
>separator is, and wehter or not there is a smart way to find the value.
>
>-- 
>Jay Vyas
>MMSB/UCHC