You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by lu...@apache.org on 2015/01/15 13:26:28 UTC

[12/50] [abbrv] incubator-kylin git commit: refactor

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/681793fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/681793fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/681793fa

Branch: refs/heads/inverted-index
Commit: 681793fa8aa2914e41dfed97fbfebb2176a96268
Parents: de59579
Author: qianhao.zhou <qi...@ebay.com>
Authored: Tue Jan 13 16:28:52 2015 +0800
Committer: qianhao.zhou <qi...@ebay.com>
Committed: Tue Jan 13 16:28:52 2015 +0800

----------------------------------------------------------------------
 .../common/restclient/Broadcaster.java          |  9 ------
 .../java/com/kylinolap/cube/CubeManager.java    | 29 +++++++-------------
 .../java/com/kylinolap/cube/model/CubeDesc.java |  2 +-
 .../query/enumerator/LookupTableEnumerator.java |  2 +-
 4 files changed, 12 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/681793fa/common/src/main/java/com/kylinolap/common/restclient/Broadcaster.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/com/kylinolap/common/restclient/Broadcaster.java b/common/src/main/java/com/kylinolap/common/restclient/Broadcaster.java
index d8d748a..67c94c1 100644
--- a/common/src/main/java/com/kylinolap/common/restclient/Broadcaster.java
+++ b/common/src/main/java/com/kylinolap/common/restclient/Broadcaster.java
@@ -93,10 +93,6 @@ public class Broadcaster {
         return BroadcasterHolder.INSTANCE;
     }
 
-    public void queueSyncMetadata() {
-        queue(TYPE.METADATA.getType(), EVENT.CREATE.getType(), "metadata");
-    }
-
     /**
      * Broadcast the cubedesc event out
      * 
@@ -111,11 +107,6 @@ public class Broadcaster {
         }
     }
 
-    public static String genEventkey(String type, String action, String name) {
-        String time = String.valueOf(System.currentTimeMillis());
-        return time + "_" + type + "_" + action + "_" + name;
-    }
-
     public static enum EVENT {
         CREATE("create"), UPDATE("update"), DROP("drop");
         private String text;

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/681793fa/cube/src/main/java/com/kylinolap/cube/CubeManager.java
----------------------------------------------------------------------
diff --git a/cube/src/main/java/com/kylinolap/cube/CubeManager.java b/cube/src/main/java/com/kylinolap/cube/CubeManager.java
index c4379df..832b520 100644
--- a/cube/src/main/java/com/kylinolap/cube/CubeManager.java
+++ b/cube/src/main/java/com/kylinolap/cube/CubeManager.java
@@ -110,7 +110,7 @@ public class CubeManager implements IRealizationProvider {
     // cube name ==> CubeInstance
     private SingleValueCache<String, CubeInstance> cubeMap = new SingleValueCache<String, CubeInstance>(Broadcaster.TYPE.CUBE);
     // "table/column" ==> lookup table
-    private SingleValueCache<String, LookupStringTable> lookupTables = new SingleValueCache<String, LookupStringTable>(Broadcaster.TYPE.METADATA);
+//    private SingleValueCache<String, LookupStringTable> lookupTables = new SingleValueCache<String, LookupStringTable>(Broadcaster.TYPE.METADATA);
 
     // for generation hbase table name of a new segment
     private HashSet<String> usedStorageLocation = new HashSet<String>();
@@ -476,26 +476,17 @@ public class CubeManager implements IRealizationProvider {
 
         String tableName = dim.getTable();
         String[] pkCols = dim.getJoin().getPrimaryKey();
-        String key = tableName + "#" + StringUtils.join(pkCols, ",");
+        String snapshotResPath = cubeSegment.getSnapshotResPath(tableName);
+        if (snapshotResPath == null)
+            throw new IllegalStateException("No snaphot for table '" + tableName + "' found on cube segment" + cubeSegment.getCubeInstance().getName() + "/" + cubeSegment);
 
-        LookupStringTable r = lookupTables.get(key);
-        if (r == null) {
-            String snapshotResPath = cubeSegment.getSnapshotResPath(tableName);
-            if (snapshotResPath == null)
-                throw new IllegalStateException("No snaphot for table '" + tableName + "' found on cube segment" + cubeSegment.getCubeInstance().getName() + "/" + cubeSegment);
-
-            try {
-                SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath);
-                TableDesc tableDesc = getMetadataManager().getTableDesc(tableName);
-                r = new LookupStringTable(tableDesc, pkCols, snapshot);
-            } catch (IOException e) {
-                throw new IllegalStateException("Failed to load lookup table " + tableName + " from snapshot " + snapshotResPath, e);
-            }
-
-            lookupTables.putLocal(key, r);
+        try {
+            SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath);
+            TableDesc tableDesc = getMetadataManager().getTableDesc(tableName);
+            return new LookupStringTable(tableDesc, pkCols, snapshot);
+        } catch (IOException e) {
+            throw new IllegalStateException("Failed to load lookup table " + tableName + " from snapshot " + snapshotResPath, e);
         }
-
-        return r;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/681793fa/cube/src/main/java/com/kylinolap/cube/model/CubeDesc.java
----------------------------------------------------------------------
diff --git a/cube/src/main/java/com/kylinolap/cube/model/CubeDesc.java b/cube/src/main/java/com/kylinolap/cube/model/CubeDesc.java
index f55411a..59a609e 100644
--- a/cube/src/main/java/com/kylinolap/cube/model/CubeDesc.java
+++ b/cube/src/main/java/com/kylinolap/cube/model/CubeDesc.java
@@ -61,7 +61,7 @@ import com.kylinolap.metadata.model.TblColRef;
 public class CubeDesc extends RootPersistentEntity {
 
     public static enum RealizationCapacity {
-        SMALL, MEDIUM, LARGE;
+        SMALL, MEDIUM, LARGE
     }
 
     public static enum DeriveType {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/681793fa/query/src/main/java/com/kylinolap/query/enumerator/LookupTableEnumerator.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/com/kylinolap/query/enumerator/LookupTableEnumerator.java b/query/src/main/java/com/kylinolap/query/enumerator/LookupTableEnumerator.java
index 5e0dfc6..428d405 100644
--- a/query/src/main/java/com/kylinolap/query/enumerator/LookupTableEnumerator.java
+++ b/query/src/main/java/com/kylinolap/query/enumerator/LookupTableEnumerator.java
@@ -44,7 +44,7 @@ public class LookupTableEnumerator implements Enumerator<Object[]> {
 
     public LookupTableEnumerator(OLAPContext olapContext) {
 
-        //TODO: assuming LookupTableEnumerator is hanlded by a cube
+        //TODO: assuming LookupTableEnumerator is handled by a cube
         CubeInstance cube = (CubeInstance) olapContext.realization;
 
         String lookupTableName = olapContext.firstTableScan.getTableName();