hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whe...@apache.org
Subject hadoop git commit: HADOOP-10555. Add offset support to MurmurHash. Contributed by Sergey Shelukhin.
Date Mon, 23 Nov 2015 02:02:55 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 6ed8f2404 -> c7a9cbbdd


HADOOP-10555. Add offset support to MurmurHash. Contributed by Sergey Shelukhin.


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

Branch: refs/heads/branch-2
Commit: c7a9cbbdde395d11d8edbd1f1933174946c31f15
Parents: 6ed8f24
Author: Haohui Mai <wheat9@apache.org>
Authored: Sun Nov 22 18:00:29 2015 -0800
Committer: Haohui Mai <wheat9@apache.org>
Committed: Sun Nov 22 18:00:41 2015 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt             | 3 +++
 .../main/java/org/apache/hadoop/util/hash/MurmurHash.java   | 9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/c7a9cbbd/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 8988ba9..fb3029a 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -345,6 +345,9 @@ Release 2.8.0 - UNRELEASED
 
     HADOOP-10035. Cleanup TestFilterFileSystem. (Suresh Srinivas via wheat9)
 
+    HADOOP-10555. Add offset support to MurmurHash.
+    (Sergey Shelukhin via wheat9)
+
   OPTIMIZATIONS
 
     HADOOP-11785. Reduce the number of listStatus operation in distcp

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c7a9cbbd/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/hash/MurmurHash.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/hash/MurmurHash.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/hash/MurmurHash.java
index 6ed3dfd..a5fc463 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/hash/MurmurHash.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/hash/MurmurHash.java
@@ -36,9 +36,13 @@ public class MurmurHash extends Hash {
   public static Hash getInstance() {
     return _instance;
   }
-  
+
   @Override
   public int hash(byte[] data, int length, int seed) {
+    return hash(data, 0, length, seed);
+  }
+
+  public int hash(byte[] data, int offset, int length, int seed) {
     int m = 0x5bd1e995;
     int r = 24;
 
@@ -47,7 +51,7 @@ public class MurmurHash extends Hash {
     int len_4 = length >> 2;
 
     for (int i = 0; i < len_4; i++) {
-      int i_4 = i << 2;
+      int i_4 = offset + (i << 2);
       int k = data[i_4 + 3];
       k = k << 8;
       k = k | (data[i_4 + 2] & 0xff);
@@ -67,6 +71,7 @@ public class MurmurHash extends Hash {
     int left = length - len_m;
 
     if (left != 0) {
+      length += offset;
       if (left >= 3) {
         h ^= (int) data[length - 3] << 16;
       }


Mime
View raw message