tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ss...@apache.org
Subject [2/2] git commit: TEZ-951. Port MAPREDUCE-5028. Contributed by Gopal V and Siddharth Seth.
Date Mon, 24 Mar 2014 18:40:59 GMT
TEZ-951. Port MAPREDUCE-5028. Contributed by Gopal V and Siddharth Seth.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tez/commit/a3a9ceaa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tez/tree/a3a9ceaa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tez/diff/a3a9ceaa

Branch: refs/heads/master
Commit: a3a9ceaad6d94200889f30a8d41cd1d42689797f
Parents: be0b47a
Author: Siddharth Seth <sseth@apache.org>
Authored: Mon Mar 24 11:40:31 2014 -0700
Committer: Siddharth Seth <sseth@apache.org>
Committed: Mon Mar 24 11:40:31 2014 -0700

----------------------------------------------------------------------
 .../library/common/sort/impl/dflt/DefaultSorter.java      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/a3a9ceaa/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
index 95256d0..5264554 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
@@ -298,7 +298,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable
{
       kvmeta.put(kvindex + VALSTART, valstart);
       kvmeta.put(kvindex + VALLEN, distanceTo(valstart, valend));
       // advance kvindex
-      kvindex = (kvindex - NMETA + kvmeta.capacity()) % kvmeta.capacity();
+      kvindex = (int)(((long)kvindex - NMETA + kvmeta.capacity()) % kvmeta.capacity());
     } catch (MapBufferTooSmallException e) {
       LOG.info("Record too large for in-memory buffer: " + e.getMessage());
       spillSingleRecord(key, value, partition);
@@ -316,8 +316,8 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable
{
     equator = pos;
     // set index prior to first entry, aligned at meta boundary
     final int aligned = pos - (pos % METASIZE);
-    kvindex =
-      ((aligned - METASIZE + kvbuffer.length) % kvbuffer.length) / 4;
+    // Cast one of the operands to long to avoid integer overflow
+    kvindex = (int) (((long) aligned - METASIZE + kvbuffer.length) % kvbuffer.length) / 4;
     if (LOG.isInfoEnabled()) {
       LOG.info("(EQUATOR) " + pos + " kvi " + kvindex +
           "(" + (kvindex * 4) + ")");
@@ -334,8 +334,8 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable
{
     bufstart = bufend = e;
     final int aligned = e - (e % METASIZE);
     // set start/end to point to first meta record
-    kvstart = kvend =
-      ((aligned - METASIZE + kvbuffer.length) % kvbuffer.length) / 4;
+    // Cast one of the operands to long to avoid integer overflow
+    kvstart = kvend = (int) (((long) aligned - METASIZE + kvbuffer.length) % kvbuffer.length)
/ 4;
     if (LOG.isInfoEnabled()) {
       LOG.info("(RESET) equator " + e + " kv " + kvstart + "(" +
         (kvstart * 4) + ")" + " kvi " + kvindex + "(" + (kvindex * 4) + ")");


Mime
View raw message