From db2d96b378d6a4ba9a504b4daaca5d8ff6f5f227 Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Fri, 10 Jun 2016 19:15:36 +0900 Subject: [PATCH] MAPREDUCE-6741. Refactor UncompressedSplitLineReader.fillBuffer(). Contributed by Daniel Templeton. (cherry picked from commit 0b7b8a377611b2a3041a2995504a437c36dfa6e6) --- .../mapreduce/lib/input/UncompressedSplitLineReader.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 bda02186e88..c2b005bb582 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 @@ 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);