in pig/src/main/java/com/twitter/elephantbird/pig/load/SequenceFileLoader.java [207:235]
public Tuple getNext() throws IOException {
try {
if (!reader.nextKeyValue()) {
return null;
}
if (readKey) {
if (readValue) {
return tupleFactory.newTupleNoCopy(Lists.newArrayList(getCurrentKeyObject(),
getCurrentValueObject()));
} else {
return tupleFactory.newTupleNoCopy(Lists.newArrayList(getCurrentKeyObject()));
}
} else if (readValue) {
return tupleFactory.newTupleNoCopy(Lists.newArrayList(getCurrentValueObject()));
} else {
throw new IllegalStateException("Cowardly refusing to read zero fields per record");
}
} catch (EOFException e) {
if (!config.genericArguments.hasOption(Config.SKIP_EOF_ERRORS_PARAM)) {
throw e;
}
LOG.warn("EOFException encountered while reading input", e);
incrCounter(Error.EOFException, 1L);
} catch (InterruptedException e) {
throw new ExecException("Error while reading input", 6018, PigException.REMOTE_ENVIRONMENT, e);
}
return null;
}