You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2020/05/18 11:52:37 UTC

[kylin] 07/07: KYLIN-4418 Bug fix for ShardingHash.getShard in HBaseLookupRowEncoder

This is an automated email from the ASF dual-hosted git repository.

nic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 7886a2498178ded085497d6204b4b367f56ce0c8
Author: Zhong, Yanghong <nj...@apache.org>
AuthorDate: Tue Mar 10 16:44:15 2020 +0800

    KYLIN-4418 Bug fix for ShardingHash.getShard in HBaseLookupRowEncoder
---
 .../org/apache/kylin/storage/hbase/lookup/HBaseLookupRowEncoder.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/lookup/HBaseLookupRowEncoder.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/lookup/HBaseLookupRowEncoder.java
index 7269465..51bd32b 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/lookup/HBaseLookupRowEncoder.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/lookup/HBaseLookupRowEncoder.java
@@ -88,7 +88,8 @@ public class HBaseLookupRowEncoder extends AbstractLookupRowEncoder<HBaseRow> {
         }
         byte[] result = new byte[RowConstants.ROWKEY_SHARDID_LEN + keyByteBuffer.position()];
         System.arraycopy(keyByteBuffer.array(), 0, result, RowConstants.ROWKEY_SHARDID_LEN, keyByteBuffer.position());
-        short shard = ShardingHash.getShard(result, RowConstants.ROWKEY_SHARDID_LEN, result.length, shardNum);
+        short shard = ShardingHash.getShard(result, RowConstants.ROWKEY_SHARDID_LEN,
+                result.length - RowConstants.ROWKEY_SHARDID_LEN, shardNum);
         BytesUtil.writeShort(shard, result, 0, RowConstants.ROWKEY_SHARDID_LEN);
         return result;
     }