MAPREDUCE-6741. Refactor UncompressedSplitLineReader.fillBuffer(). Contributed by Daniel Templeton.

This commit is contained in:
Akira Ajisaka 2016-06-10 19:15:36 +09:00
parent 9581fb715c
commit 0b7b8a3776
1 changed files with 4 additions and 4 deletions

View File

@ -53,10 +53,10 @@ public class UncompressedSplitLineReader extends SplitLineReader {
throws IOException {
int maxBytesToRead = buffer.length;
if (totalBytesRead < splitLength) {
long leftBytesForSplit = splitLength - totalBytesRead;
// check if leftBytesForSplit exceed Integer.MAX_VALUE
if (leftBytesForSplit <= Integer.MAX_VALUE) {
maxBytesToRead = Math.min(maxBytesToRead, (int)leftBytesForSplit);
long bytesLeftInSplit = splitLength - totalBytesRead;
if (bytesLeftInSplit < maxBytesToRead) {
maxBytesToRead = (int)bytesLeftInSplit;
}
}
int bytesRead = in.read(buffer, 0, maxBytesToRead);