Once Jobtracker gets the Splits with getsplits() function of InputFormat class. Then the jobtracker assigns maptasks based on the storage location of the split and maptask calls the createrecordreader() method in InputFormat class which in turn calls linerecordreader class.The initialize function gets the start,end position and nextkeyvalue() sets the key,value. Here is what my query is, Key is set with pos as per below code.But how is the value set.
public boolean nextKeyValue() throws IOException {
if (key == null) {
key = new LongWritable();
}
key.set(pos);
if (value == null) {
value = new Text();
}
int newSize = 0;
while (pos < end) {
newSize = in.readLine(value, maxLineLength,
Math.max((int)Math.min(Integer.MAX_VALUE, end-pos),maxLineLength))
if (newSize == 0) {
break;
}
pos += newSize;
if (newSize < maxLineLength) {
break;
}
// line too long. try again
LOG.info("Skipped line of size " + newSize + " at pos " +
(pos - newSize));
}
if (newSize == 0) {
key = null;
value = null;
return false;
} else {
return true;
}
}