You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2016/03/15 11:03:27 UTC

kylin git commit: KYLIN-1492 bug fix

Repository: kylin
Updated Branches:
  refs/heads/master 7b7e7bb60 -> 697c83778


KYLIN-1492 bug fix


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

Branch: refs/heads/master
Commit: 697c83778cff8c9afacc186e715f8fa509296b21
Parents: 7b7e7bb
Author: Li Yang <li...@apache.org>
Authored: Tue Mar 15 18:03:07 2016 +0800
Committer: Li Yang <li...@apache.org>
Committed: Tue Mar 15 18:03:20 2016 +0800

----------------------------------------------------------------------
 .../endpoint/ClearTextDictionary.java           | 48 +++++++-------------
 .../coprocessor/endpoint/LocalDictionary.java   | 15 ++++--
 2 files changed, 28 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/697c8377/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/ClearTextDictionary.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/ClearTextDictionary.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/ClearTextDictionary.java
index 2c882c8..0722faf 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/ClearTextDictionary.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/ClearTextDictionary.java
@@ -1,35 +1,19 @@
 /*
- *
- *
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *
- *  contributor license agreements. See the NOTICE file distributed with
- *
- *  this work for additional information regarding copyright ownership.
- *
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *
- *  (the "License"); you may not use this file except in compliance with
- *
- *  the License. You may obtain a copy of the License at
- *
- *
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *
- *
- *  Unless required by applicable law or agreed to in writing, software
- *
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- *  See the License for the specific language governing permissions and
- *
- *  limitations under the License.
- *
- * /
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.kylin.storage.hbase.ii.coprocessor.endpoint;
@@ -57,7 +41,7 @@ public class ClearTextDictionary implements IDimensionEncodingMap {
     public ClearTextDictionary(TableRecordInfoDigest digest, CoprocessorRowType coprocessorRowType) {
         encMap = Maps.newHashMap();
         for (Entry<TblColRef, Integer> entry : coprocessorRowType.columnIdxMap.entrySet()) {
-            encMap.put(entry.getKey(), new FixedLenDimEnc(entry.getValue()));
+            encMap.put(entry.getKey(), new FixedLenDimEnc(digest.length(entry.getValue())));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/697c8377/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/LocalDictionary.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/LocalDictionary.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/LocalDictionary.java
index 3c54ed8..239fe23 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/LocalDictionary.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/ii/coprocessor/endpoint/LocalDictionary.java
@@ -21,6 +21,7 @@ package org.apache.kylin.storage.hbase.ii.coprocessor.endpoint;
 import java.util.Map;
 
 import org.apache.kylin.dimension.Dictionary;
+import org.apache.kylin.dimension.DictionaryDimEnc;
 import org.apache.kylin.dimension.DimensionEncoding;
 import org.apache.kylin.dimension.FixedLenDimEnc;
 import org.apache.kylin.dimension.IDimensionEncodingMap;
@@ -50,8 +51,15 @@ public class LocalDictionary implements IDimensionEncodingMap {
     public DimensionEncoding get(TblColRef col) {
         DimensionEncoding result = encMap.get(col);
         if (result == null) {
-            int len = recordInfo.length(type.getColIndexByTblColRef(col));
-            encMap.put(col, result = new FixedLenDimEnc(len));
+            Dictionary<String> dict = getDictionary(col);
+            if (dict == null) {
+                int idx = type.getColIndexByTblColRef(col);
+                int len = recordInfo.length(idx);
+                result = new FixedLenDimEnc(len);
+            } else {
+                result = new DictionaryDimEnc(dict);
+            }
+            encMap.put(col, result);
         }
         return result;
     }
@@ -59,7 +67,8 @@ public class LocalDictionary implements IDimensionEncodingMap {
     @SuppressWarnings("unchecked")
     @Override
     public Dictionary<String> getDictionary(TblColRef col) {
-        return (Dictionary<String>) this.colDictMap[type.getColIndexByTblColRef(col)];
+        int idx = type.getColIndexByTblColRef(col);
+        return (Dictionary<String>) this.colDictMap[idx];
     }
 
 }