MAPREDUCE-6741. Refactor UncompressedSplitLineReader.fillBuffer(). Contributed by Daniel Templeton.
(cherry picked from commit 0b7b8a3776
)
This commit is contained in:
parent
1925942294
commit
db2d96b378
|
@ -53,10 +53,10 @@ public class UncompressedSplitLineReader extends SplitLineReader {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
int maxBytesToRead = buffer.length;
|
int maxBytesToRead = buffer.length;
|
||||||
if (totalBytesRead < splitLength) {
|
if (totalBytesRead < splitLength) {
|
||||||
long leftBytesForSplit = splitLength - totalBytesRead;
|
long bytesLeftInSplit = splitLength - totalBytesRead;
|
||||||
// check if leftBytesForSplit exceed Integer.MAX_VALUE
|
|
||||||
if (leftBytesForSplit <= Integer.MAX_VALUE) {
|
if (bytesLeftInSplit < maxBytesToRead) {
|
||||||
maxBytesToRead = Math.min(maxBytesToRead, (int)leftBytesForSplit);
|
maxBytesToRead = (int)bytesLeftInSplit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int bytesRead = in.read(buffer, 0, maxBytesToRead);
|
int bytesRead = in.read(buffer, 0, maxBytesToRead);
|
||||||
|
|
Loading…
Reference in New Issue