diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/UncompressedSplitLineReader.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/UncompressedSplitLineReader.java index bda02186e8..c2b005bb58 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/UncompressedSplitLineReader.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/UncompressedSplitLineReader.java @@ -53,10 +53,10 @@ protected int fillBuffer(InputStream in, byte[] buffer, boolean inDelimiter) 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);