You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-dev@hadoop.apache.org by "Daniel Templeton (JIRA)" <ji...@apache.org> on 2016/06/10 00:57:20 UTC
[jira] [Created] (MAPREDUCE-6714) Refactor
UncompressedSplitLineReader.fillBuffer()
Daniel Templeton created MAPREDUCE-6714:
-------------------------------------------
Summary: Refactor UncompressedSplitLineReader.fillBuffer()
Key: MAPREDUCE-6714
URL: https://issues.apache.org/jira/browse/MAPREDUCE-6714
Project: Hadoop Map/Reduce
Issue Type: Improvement
Affects Versions: 2.8.0
Reporter: Daniel Templeton
MAPREDUCE-6635 made this change:
{code}
- maxBytesToRead = Math.min(maxBytesToRead,
- (int)(splitLength - totalBytesRead));
+ long leftBytesForSplit = splitLength - totalBytesRead;
+ // check if leftBytesForSplit exceed Integer.MAX_VALUE
+ if (leftBytesForSplit <= Integer.MAX_VALUE) {
+ maxBytesToRead = Math.min(maxBytesToRead, (int)leftBytesForSplit);
+ }
{code}
The result is one more comparison than necessary and code that's a little convoluted. The code can be simplified as:
{code}
long leftBytesForSplit = splitLength - totalBytesRead;
if (leftBytesForSplit < maxBytesToRead) {
maxBytesToRead = (int)leftBytesForSplit;
}
{code}
The comparison will auto promote {{maxBytesToRead}}, making it safe.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: mapreduce-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: mapreduce-dev-help@hadoop.apache.org