You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2015/11/05 02:33:27 UTC

[04/19] incubator-kylin git commit: support global dict in HBaseClientKVIterator

support global dict in HBaseClientKVIterator


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

Branch: refs/heads/KYLIN-1112-2
Commit: ca6f578d289d4c358f6af71c7dc3380c4e4422ff
Parents: 37d0602
Author: shaofengshi <sh...@apache.org>
Authored: Mon Nov 2 16:19:08 2015 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Thu Nov 5 09:24:17 2015 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/invertedindex/model/IIKeyValueCodec.java  | 2 +-
 .../kylin/storage/hbase/cube/v1/HBaseClientKVIterator.java     | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ca6f578d/invertedindex/src/main/java/org/apache/kylin/invertedindex/model/IIKeyValueCodec.java
----------------------------------------------------------------------
diff --git a/invertedindex/src/main/java/org/apache/kylin/invertedindex/model/IIKeyValueCodec.java b/invertedindex/src/main/java/org/apache/kylin/invertedindex/model/IIKeyValueCodec.java
index eebf756..7e54a98 100644
--- a/invertedindex/src/main/java/org/apache/kylin/invertedindex/model/IIKeyValueCodec.java
+++ b/invertedindex/src/main/java/org/apache/kylin/invertedindex/model/IIKeyValueCodec.java
@@ -199,7 +199,7 @@ public class IIKeyValueCodec implements KeyValueCodec {
                             valueContainers[curCol] = c;
                         } else {
                             final ImmutableBytesWritable dictBytes = row.getDictionary();
-                            if (dictBytes.get() != null && dictBytes.getLength() != 0) {
+                            if (dictBytes.getLength() != 0) {
                                 final Dictionary<?> dictionary = DictionarySerializer.deserialize(new ByteArray(dictBytes.get(), dictBytes.getOffset(), dictBytes.getLength()));
                                 CompressedValueContainer c = new CompressedValueContainer(dictionary.getSizeOfId(), dictionary.getMaxId() - dictionary.getMinId() + 1, 0);
                                 c.fromBytes(row.getValue());

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ca6f578d/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v1/HBaseClientKVIterator.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v1/HBaseClientKVIterator.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v1/HBaseClientKVIterator.java
index b18d258..7920a8a 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v1/HBaseClientKVIterator.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v1/HBaseClientKVIterator.java
@@ -69,6 +69,7 @@ public class HBaseClientKVIterator implements Iterable<IIRow>, Closeable {
         ImmutableBytesWritable value = new ImmutableBytesWritable();
         ImmutableBytesWritable dict = new ImmutableBytesWritable();
         IIRow pair = new IIRow(key, value, dict);
+        static final byte[] EMPTY_BYTES = new byte[0];
 
         @Override
         public boolean hasNext() {
@@ -82,8 +83,11 @@ public class HBaseClientKVIterator implements Iterable<IIRow>, Closeable {
             key.set(c.getRowArray(), c.getRowOffset(), c.getRowLength());
             value.set(c.getValueArray(), c.getValueOffset(), c.getValueLength());
             c = r.getColumnLatestCell(IIDesc.HBASE_FAMILY_BYTES, IIDesc.HBASE_DICTIONARY_BYTES);
-            if (c != null)
+            if (c != null) {
                 dict.set(c.getValueArray(), c.getValueOffset(), c.getValueLength());
+            } else {
+                dict.set(EMPTY_BYTES);
+            }
             return pair;
         }