On Oct 28, 2008, at 6:29 AM, Malcolm Matalka wrote:
I am trying to write an InputFormat and I am having some trouble
understanding how my data is being broken up. My input is a previous
hadoop job and I have added code to my record reader to print out the
FileSplit's start and end position, as well as where the last record I
read was located. My record are all about 100 bytes so fairly small.
For one file I am seeing the following output:
start: 0 end: 45101881 pos: 67108800
start: 45101880 end: 90203762 pos: 67108810
start: 90203761 end: 135305643 pos: 134217621
start: 135305642 end: 180170980 pos: 180170902
It would help if you printed the FIleSplits themselves, so that we can
see the file names. I don't know where the "pos" is coming from.
FileSplits only have offset and length.
Note, I have also specified in my InputFormat that isSplittable return
false.
That isn't working. Otherwise, you would only have FileSplits that
start at 0.
I do not understand why there is overlap. Note that on the second
one,
I never appear to reach the end position.
The RecordReaders have to read more than their split because they can
only process whole records. So, in the case of text files and
TextInputFormat, the split is picked blindly. Then all of the splits
that don't start at offset 0, read until they reach a newline. They
start from there and read until the newline *past* the end of the
split. That way all of the data is processed and no partial records
are processed.
-- Owen