drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prog...@apache.org
Subject [3/9] drill git commit: DRILL-5816: Hash function produces skewed results on String values with same leading prefix Note: Changing hash32 computation to use Murmur3.hash32 instead of int casted version of Murmur3.hash64
Date Mon, 02 Oct 2017 17:30:45 GMT
DRILL-5816: Hash function produces skewed results on String values with same leading prefix
            Note: Changing hash32 computation to use Murmur3.hash32 instead of int casted
version of Murmur3.hash64

closes #959


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

Branch: refs/heads/master
Commit: d59421be4390ed00cec3d4378e15dae790323d40
Parents: dfd33e1
Author: Sorabh Hamirwasia <shamirwasia@maprtech.com>
Authored: Fri Sep 15 15:07:50 2017 -0700
Committer: Paul Rogers <progers@maprtech.com>
Committed: Sat Sep 30 19:07:08 2017 -0700

----------------------------------------------------------------------
 .../apache/drill/exec/expr/fn/impl/MurmurHash3.java  | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/d59421be/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MurmurHash3.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MurmurHash3.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MurmurHash3.java
index b21117b..e51c63c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MurmurHash3.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MurmurHash3.java
@@ -259,21 +259,20 @@ public final class MurmurHash3 extends DrillHash{
     return (int)lh1;
   }
 
-  public static long hash64(double val, long seed){
-    return murmur3_64(Double.doubleToLongBits(val), (int)seed);
+  public static long hash64(double val, long seed) {
+    return murmur3_64(Double.doubleToLongBits(val), (int) seed);
   }
 
-  public static long hash64(long start, long end, DrillBuf buffer, long seed){
-    return murmur3_64(start, end, buffer, (int)seed);
+  public static long hash64(long start, long end, DrillBuf buffer, long seed) {
+    return murmur3_64(start, end, buffer, (int) seed);
   }
 
   public static int hash32(double val, long seed) {
-    //return com.google.common.hash.Hashing.murmur3_128().hashLong(Double.doubleToLongBits(val)).asInt();
-    return (int)murmur3_64(Double.doubleToLongBits(val), (int)seed);
+    return murmur3_32(Double.doubleToLongBits(val), (int) seed);
   }
 
-  public static int hash32(int start, int end, DrillBuf buffer, int seed){
-    return (int)murmur3_64(start, end, buffer, seed);
+  public static int hash32(int start, int end, DrillBuf buffer, int seed) {
+    return murmur3_32(start, end, buffer, seed);
   }
 
 }


Mime
View raw message