Repository: kylin
Updated Branches:
  refs/heads/yang-m1 e94299dc6 -> 7fb768a64


bug fix


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

Branch: refs/heads/yang-m1
Commit: 7fb768a64eda80ed2b24c0d285bf00fe5995f293
Parents: e94299d
Author: Hongbin Ma <mahong...@apache.org>
Authored: Wed Apr 20 17:14:51 2016 +0800
Committer: Hongbin Ma <mahong...@apache.org>
Committed: Wed Apr 20 17:14:51 2016 +0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/kylin/common/util/ByteArray.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/7fb768a6/core-common/src/main/java/org/apache/kylin/common/util/ByteArray.java
----------------------------------------------------------------------
diff --git 
a/core-common/src/main/java/org/apache/kylin/common/util/ByteArray.java 
b/core-common/src/main/java/org/apache/kylin/common/util/ByteArray.java
index 718ec31..55710e9 100644
--- a/core-common/src/main/java/org/apache/kylin/common/util/ByteArray.java
+++ b/core-common/src/main/java/org/apache/kylin/common/util/ByteArray.java
@@ -134,10 +134,10 @@ public class ByteArray implements Comparable<ByteArray>, 
Serializable {
         if (data == null) {
             return 0;
         } else {
-            if (length <= Bytes.SIZEOF_LONG) {
+            if (length <= Bytes.SIZEOF_LONG && length > 0) {
                 //to avoid hash collision of byte arrays those are converted 
from nearby integers/longs, 
                 //which is the case for kylin dictionary
-                return Long.valueOf(Bytes.toLong(data, offset, 
length)).hashCode();
+                return Long.valueOf(BytesUtil.readLong(data, offset, 
length)).hashCode();
             }
             return Bytes.hashCode(data, offset, length);
         }

Reply via email to