kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [31/34] incubator-kylin git commit: refactor
Date Fri, 10 Apr 2015 22:48:08 GMT
refactor


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

Branch: refs/heads/streaming-localdict
Commit: 773ec7f280049040e35999873cedae8d411e24d5
Parents: 5c2a31a
Author: qianhao.zhou <qianzhou@ebay.com>
Authored: Fri Apr 10 16:33:02 2015 +0800
Committer: qianhao.zhou <qianzhou@ebay.com>
Committed: Fri Apr 10 16:33:02 2015 +0800

----------------------------------------------------------------------
 .../apache/kylin/invertedindex/index/TableRecord.java   |  3 ++-
 .../kylin/invertedindex/index/TableRecordInfo.java      | 12 +++++-------
 .../coprocessor/endpoint/EndpointAggregationTest.java   |  2 +-
 .../kylin/streaming/invertedindex/SliceBuilder.java     |  6 +++---
 4 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/773ec7f2/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecord.java
----------------------------------------------------------------------
diff --git a/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecord.java
b/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecord.java
index 15869f9..d317682 100644
--- a/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecord.java
+++ b/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecord.java
@@ -76,7 +76,8 @@ public class TableRecord implements Cloneable {
             LongWritable v = rawRecord.codec(col).valueOf(value);
             setValueMetrics(col, v);
         } else {
-            int id = info.dict(col).getIdFromValue(value);
+            final Dictionary<String> dict = info.dict(col);
+            int id = dict.getIdFromValue(value);
             rawRecord.setValueID(col, id);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/773ec7f2/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecordInfo.java
----------------------------------------------------------------------
diff --git a/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecordInfo.java
b/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecordInfo.java
index 606e00e..56c02e4 100644
--- a/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecordInfo.java
+++ b/invertedindex/src/main/java/org/apache/kylin/invertedindex/index/TableRecordInfo.java
@@ -18,9 +18,7 @@
 
 package org.apache.kylin.invertedindex.index;
 
-import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.kylin.common.util.Array;
 import org.apache.kylin.dict.Dictionary;
@@ -41,7 +39,7 @@ public class TableRecordInfo {
     final IIDesc desc;
 
     final TableRecordInfoDigest digest;
-    final Dictionary<?>[] dictionaryMap;
+    final Dictionary<?>[] dictionaries;
 
     public TableRecordInfo(IISegment iiSegment) {
         this(iiSegment.getIIDesc());
@@ -51,10 +49,10 @@ public class TableRecordInfo {
         this(desc, new Dictionary<?>[0]);
     }
 
-    public TableRecordInfo(IIDesc desc, Dictionary<?>[] dictionaryMap) {
+    public TableRecordInfo(IIDesc desc, Dictionary<?>[] dictionaries) {
         this.desc = desc;
-        this.dictionaryMap = dictionaryMap;
-        this.digest = createDigest(desc, dictionaryMap);
+        this.dictionaries = dictionaries;
+        this.digest = createDigest(desc, dictionaries);
     }
 
     public TableRecordInfoDigest getDigest() {
@@ -139,7 +137,7 @@ public class TableRecordInfo {
     @SuppressWarnings("unchecked")
     public Dictionary<String> dict(int col) {
         // yes, all dictionaries are string based
-        return (Dictionary<String>) dictionaryMap[col];
+        return (Dictionary<String>) dictionaries[col];
     }
 
     public int getTimestampColumn() {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/773ec7f2/storage/src/test/java/org/apache/kylin/storage/hbase/coprocessor/endpoint/EndpointAggregationTest.java
----------------------------------------------------------------------
diff --git a/storage/src/test/java/org/apache/kylin/storage/hbase/coprocessor/endpoint/EndpointAggregationTest.java
b/storage/src/test/java/org/apache/kylin/storage/hbase/coprocessor/endpoint/EndpointAggregationTest.java
index 7cb0d09..3d4d324 100644
--- a/storage/src/test/java/org/apache/kylin/storage/hbase/coprocessor/endpoint/EndpointAggregationTest.java
+++ b/storage/src/test/java/org/apache/kylin/storage/hbase/coprocessor/endpoint/EndpointAggregationTest.java
@@ -118,7 +118,7 @@ public class EndpointAggregationTest extends LocalFileMetadataTestCase
{
         System.arraycopy(groupOne, 0, data, tableRecordInfo.getDigest().offset(groupByColumnIndex),
groupOne.length);
         result.add(data);
 
-        data = randomBytes(tableRecordInfo.getDigest().getByteFormLen());;
+        data = randomBytes(tableRecordInfo.getDigest().getByteFormLen());
         codec.write(codec.valueOf("2.09"), data, tableRecordInfo.getDigest().offset(priceColumnIndex));
         System.arraycopy(groupOne, 0, data, tableRecordInfo.getDigest().offset(groupByColumnIndex),
groupOne.length);
         result.add(data);

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/773ec7f2/streaming/src/main/java/org/apache/kylin/streaming/invertedindex/SliceBuilder.java
----------------------------------------------------------------------
diff --git a/streaming/src/main/java/org/apache/kylin/streaming/invertedindex/SliceBuilder.java
b/streaming/src/main/java/org/apache/kylin/streaming/invertedindex/SliceBuilder.java
index 6246215..2061a5a 100644
--- a/streaming/src/main/java/org/apache/kylin/streaming/invertedindex/SliceBuilder.java
+++ b/streaming/src/main/java/org/apache/kylin/streaming/invertedindex/SliceBuilder.java
@@ -75,9 +75,9 @@ public final class SliceBuilder {
                 return streamParser.parse(input);
             }
         });
-        final Dictionary<?>[] dictionaryMap = IIDictionaryBuilder.buildDictionary(table,
iiDesc);
-        TableRecordInfo tableRecordInfo = new TableRecordInfo(iiDesc, dictionaryMap);
-        return build(table,  tableRecordInfo, dictionaryMap);
+        final Dictionary<?>[] dictionaries = IIDictionaryBuilder.buildDictionary(table,
iiDesc);
+        TableRecordInfo tableRecordInfo = new TableRecordInfo(iiDesc, dictionaries);
+        return build(table,  tableRecordInfo, dictionaries);
     }
 
     private Slice build(List<List<String>> table,  final TableRecordInfo tableRecordInfo,
Dictionary<?>[] localDictionary) {


Mime
View raw message