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 2015/01/31 13:01:41 UTC

[14/50] incubator-kylin git commit: Merge branch 'inverted-index' of https://github.com/KylinOLAP/Kylin into inverted-index

Merge branch 'inverted-index' of https://github.com/KylinOLAP/Kylin into inverted-index

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

Branch: refs/heads/inverted-index
Commit: 06955b59cbc95abe484914ee2d18e7c5080393a8
Parents: a1afffd
Author: Shao Feng, Shi <sh...@hotmail.com>
Authored: Wed Jan 28 15:28:37 2015 +0800
Committer: Shao Feng, Shi <sh...@hotmail.com>
Committed: Wed Jan 28 16:17:24 2015 +0800

----------------------------------------------------------------------
 .../com/kylinolap/common/util/StringUtil.java   |  12 ++
 .../com/kylinolap/cube/CubeDescUpgrader.java    |   9 +-
 .../java/com/kylinolap/cube/model/CubeDesc.java | 119 +++++-------------
 .../com/kylinolap/cube/model/DimensionDesc.java | 120 ++++++++++---------
 .../localmeta_v1/cube/test_kylin_cube_ii.json   |  39 ------
 .../kylinolap/invertedindex/model/IIDesc.java   |  14 +--
 pom.xml                                         |   8 +-
 7 files changed, 122 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/06955b59/common/src/main/java/com/kylinolap/common/util/StringUtil.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/com/kylinolap/common/util/StringUtil.java b/common/src/main/java/com/kylinolap/common/util/StringUtil.java
index 6a3eaa3..89b6181 100644
--- a/common/src/main/java/com/kylinolap/common/util/StringUtil.java
+++ b/common/src/main/java/com/kylinolap/common/util/StringUtil.java
@@ -18,6 +18,8 @@ package com.kylinolap.common.util;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * Created with IntelliJ IDEA. User: lukhan Date: 12/2/13 Time: 11:43 AM To
  * change this template use File | Settings | File Templates.
@@ -96,4 +98,14 @@ public class StringUtil {
         else
             return s1.compareTo(s2) > 0 ? s1 : s2;
     }
+
+    public static boolean contains(String[] haystack, String needle) {
+        if (haystack != null) {
+            for (int i = 0, n = haystack.length; i < n; i++) {
+                if (StringUtils.equals(haystack[i], needle))
+                    return true;
+            }
+        }
+        return false;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/06955b59/cube/src/main/java/com/kylinolap/cube/CubeDescUpgrader.java
----------------------------------------------------------------------
diff --git a/cube/src/main/java/com/kylinolap/cube/CubeDescUpgrader.java b/cube/src/main/java/com/kylinolap/cube/CubeDescUpgrader.java
index 6502e5c..99037b4 100644
--- a/cube/src/main/java/com/kylinolap/cube/CubeDescUpgrader.java
+++ b/cube/src/main/java/com/kylinolap/cube/CubeDescUpgrader.java
@@ -106,11 +106,13 @@ public class CubeDescUpgrader {
             com.kylinolap.cube.model.DimensionDesc newDim = null;
             // if a dimension defines "column", "derived" and "hierarchy" at the same time, separate it into three dimensions;
 
+            boolean needNameSuffix = false;
             if (dim.getColumn() != null && !"{FK}".equals(dim.getColumn())) {
                 //column on fact table
                 newDim = newDimensionDesc(dim, dimId++, dim.getName());
                 newDimensions.add(newDim);
                 newDim.setColumn(new String[] { dim.getColumn() });
+                needNameSuffix = true;
             } else if (ArrayUtils.isEmpty(dim.getDerived()) && ArrayUtils.isEmpty(dim.getHierarchy())) {
                 // user defines a lookup table, but didn't use any column other than the pk, in this case, convert to use fact table's fk
                 newDim = newDimensionDesc(dim, dimId++, dim.getName());
@@ -121,14 +123,15 @@ public class CubeDescUpgrader {
             }
 
             if (!ArrayUtils.isEmpty(dim.getDerived())) {
-                newDim = newDimensionDesc(dim, dimId++, dim.getName() + "_derived");
+                newDim = newDimensionDesc(dim, dimId++, dim.getName() + (needNameSuffix ? "_DERIVED" : ""));
                 newDimensions.add(newDim);
                 newDim.setDerived(dim.getDerived());
                 newDim.setColumn(null); // derived column must come from a lookup table; in this case the fk will be the dimension column, no need to explicitly declare it;
+                needNameSuffix = true;
             }
 
             if (!ArrayUtils.isEmpty(dim.getHierarchy())) {
-                newDim = newDimensionDesc(dim, dimId++, dim.getName() + "_hierarchy");
+                newDim = newDimensionDesc(dim, dimId++, dim.getName() + (needNameSuffix ? "_HIERARCHY" : ""));
                 newDimensions.add(newDim);
 
                 newDim.setHierarchy(true);
@@ -150,7 +153,7 @@ public class CubeDescUpgrader {
         DataModelDesc dm = new DataModelDesc();
         dm.setUuid(UUID.randomUUID().toString());
         String factTable = oldModel.getFactTable();
-        dm.setName("model_" + oldModel.getName());
+        dm.setName(oldModel.getName());
         dm.setFactTable(getMetadataManager().appendDBName(factTable));
 
         newModel.setModelName(dm.getName());

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/06955b59/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 39a4704..59d1f6f 100644
--- a/cube/src/main/java/com/kylinolap/cube/model/CubeDesc.java
+++ b/cube/src/main/java/com/kylinolap/cube/model/CubeDesc.java
@@ -25,7 +25,6 @@ import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -47,6 +46,7 @@ import com.kylinolap.common.persistence.RootPersistentEntity;
 import com.kylinolap.common.util.Array;
 import com.kylinolap.common.util.CaseInsensitiveStringMap;
 import com.kylinolap.common.util.JsonUtil;
+import com.kylinolap.common.util.StringUtil;
 import com.kylinolap.metadata.MetadataConstances;
 import com.kylinolap.metadata.MetadataManager;
 import com.kylinolap.metadata.model.ColumnDesc;
@@ -120,8 +120,6 @@ public class CubeDesc extends RootPersistentEntity {
     private Map<TblColRef, DeriveInfo> derivedToHostMap = Maps.newHashMap();
     private Map<Array<TblColRef>, List<DeriveInfo>> hostToDerivedMap = Maps.newHashMap();
 
-    /* indicate whether this object was upgraded on an old version*/
-    private boolean upgraded = false;
     /**
      * Error messages during resolving json metadata
      */
@@ -231,10 +229,6 @@ public class CubeDesc extends RootPersistentEntity {
         return result;
     }
 
-    //    public boolean isFactTable(String factTable) {
-    //        return this.factTable.equalsIgnoreCase(factTable);
-    //    }
-
     public boolean isDerived(TblColRef col) {
         return derivedToHostMap.containsKey(col);
     }
@@ -438,38 +432,8 @@ public class CubeDesc extends RootPersistentEntity {
             this.addError("No data model found with name '" + modelName + "'.");
         }
 
-        //key: column name; value: list of tables;
-        Map<String, List<TableDesc>> columnTableMap = new HashMap<String, List<TableDesc>>();
-
-        String colName;
-        for (TableDesc table : tables.values()) {
-            for (ColumnDesc col : table.getColumns()) {
-                colName = col.getName();
-                List<TableDesc> tableNames = columnTableMap.get(colName);
-                if (tableNames == null) {
-                    tableNames = new LinkedList<TableDesc>();
-                    columnTableMap.put(colName, tableNames);
-                }
-                tableNames.add(table);
-            }
-        }
-
-        // key: table name; value: list of databases;
-        Map<String, List<String>> tableDatabaseMap = new HashMap<String, List<String>>();
-
-        String tableName;
-        for (TableDesc table : tables.values()) {
-            tableName = table.getName();
-            List<String> dbNames = tableDatabaseMap.get(tableName);
-            if (dbNames == null) {
-                dbNames = new LinkedList<String>();
-                tableDatabaseMap.put(tableName, dbNames);
-            }
-            dbNames.add(table.getDatabase());
-        }
-
         for (DimensionDesc dim : dimensions) {
-            dim.init(this, tables, columnTableMap, tableDatabaseMap);
+            dim.init(this, tables);
         }
 
         sortDimAndMeasure();
@@ -495,57 +459,43 @@ public class CubeDesc extends RootPersistentEntity {
     }
 
     private void initDimensionColumns(Map<String, TableDesc> tables) {
-        // fill back ColRefDesc
         for (DimensionDesc dim : dimensions) {
             TableDesc dimTable = dim.getTableDesc();
             JoinDesc join = dim.getJoin();
 
-            ArrayList<TblColRef> dimColList = new ArrayList<TblColRef>();
-            ArrayList<TblColRef> hostColList = new ArrayList<TblColRef>();
-
-            // dimension column
-            if (dim.getColumn() != null) {
-                //if ("{FK}".equals(dim.getColumn())) {
-                if (join != null) {
-                    // this dimension is defined on lookup table
-                    for (TblColRef ref : join.getForeignKeyColumns()) {
-                        TblColRef inited = initDimensionColRef(ref);
-                        dimColList.add(inited);
-                        hostColList.add(inited);
-                    }
-                } else {
-                    // this dimension is defined on fact table
-                    for (String aColumn : dim.getColumn()) {
-                        TblColRef ref = initDimensionColRef(dimTable, aColumn);
-                        if (!dimColList.contains(ref)) {
-                            dimColList.add(ref);
-                            //hostColList.add(ref);
-                        }
-                    }
+            // init dimension columns
+            ArrayList<TblColRef> dimCols = Lists.newArrayList();
+            String[] colStrs = dim.getColumn();
+            
+            // when column is omitted, special case
+            if (colStrs == null && dim.isDerived() || StringUtil.contains(colStrs, "{FK}")) {
+                for (TblColRef col : join.getForeignKeyColumns()) {
+                    dimCols.add(initDimensionColRef(col));
                 }
             }
-
-            // hierarchy columns
-            if (dim.getHierarchy() != null) {
-                for (HierarchyDesc hier : dim.getHierarchy()) {
-                    TblColRef ref = initDimensionColRef(dimTable, hier.getColumn());
-                    hier.setColumnRef(ref);
-                    if (!dimColList.contains(ref))
-                        dimColList.add(ref);
+            // normal case
+            else {
+                if (colStrs == null || colStrs.length == 0)
+                    throw new IllegalStateException("Dimension column must not be blank " + dim);
+                
+                for (String colStr : colStrs) {
+                    dimCols.add(initDimensionColRef(dimTable, colStr));
                 }
-                if (hostColList.isEmpty()) { // the last hierarchy could serve
-                                             // as host when col is
-                                             // unspecified
-                    hostColList.add(dimColList.get(dimColList.size() - 1));
+                
+                // fill back column ref in hierarchy
+                if (dim.isHierarchy()) {
+                    for (int i = 0; i < dimCols.size(); i++)
+                        dim.getHierarchy()[i].setColumnRef(dimCols.get(i));
                 }
             }
-            TblColRef[] dimCols = (TblColRef[]) dimColList.toArray(new TblColRef[dimColList.size()]);
-            dim.setColumnRefs(dimCols);
+            
+            TblColRef[] dimColArray = (TblColRef[]) dimCols.toArray(new TblColRef[dimCols.size()]);
+            dim.setColumnRefs(dimColArray);
 
-            // lookup derived columns
-            TblColRef[] hostCols = (TblColRef[]) hostColList.toArray(new TblColRef[hostColList.size()]);
-            String[] derived = dim.getDerived();
-            if (derived != null) {
+            // init derived columns
+            TblColRef[] hostCols = dimColArray;
+            if (dim.isDerived()) {
+                String[] derived = dim.getDerived();
                 String[][] split = splitDerivedColumnAndExtra(derived);
                 String[] derivedNames = split[0];
                 String[] derivedExtra = split[1];
@@ -556,7 +506,7 @@ public class CubeDesc extends RootPersistentEntity {
                 initDerivedMap(hostCols, DeriveType.LOOKUP, dim, derivedCols, derivedExtra);
             }
 
-            // FK derived column
+            // PK-FK derive the other side
             if (join != null) {
                 TblColRef[] fk = join.getForeignKeyColumns();
                 TblColRef[] pk = join.getPrimaryKeyColumns();
@@ -797,13 +747,4 @@ public class CubeDesc extends RootPersistentEntity {
         this.nullStrings = nullStrings;
     }
 
-    public boolean isUpgraded() {
-        return upgraded;
-    }
-
-    public void setUpgraded(boolean upgraded) {
-        this.upgraded = upgraded;
-    }
-
-    
 }

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/06955b59/cube/src/main/java/com/kylinolap/cube/model/DimensionDesc.java
----------------------------------------------------------------------
diff --git a/cube/src/main/java/com/kylinolap/cube/model/DimensionDesc.java b/cube/src/main/java/com/kylinolap/cube/model/DimensionDesc.java
index 45d1952..3878d9b 100644
--- a/cube/src/main/java/com/kylinolap/cube/model/DimensionDesc.java
+++ b/cube/src/main/java/com/kylinolap/cube/model/DimensionDesc.java
@@ -59,6 +59,57 @@ public class DimensionDesc {
     private TblColRef[] columnRefs;
     private TblColRef[] derivedColRefs;
 
+    public void init(CubeDesc cubeDesc, Map<String, TableDesc> tables) {
+        if (name != null)
+            name = name.toUpperCase();
+
+        if (table != null)
+            table = table.toUpperCase();
+
+        tableDesc = tables.get(this.getTable());
+        if (tableDesc == null)
+            throw new IllegalStateException("Can't find table " + table + " for dimension " + name);
+
+        join = null;
+        for (LookupDesc lookup : cubeDesc.getModel().getLookups()) {
+            if (lookup.getTable().equalsIgnoreCase(this.getTable())) {
+                join = lookup.getJoin();
+                break;
+            }
+        }
+
+        if (isHierarchy && this.column.length > 0) {
+            List<HierarchyDesc> hierarchyList = new ArrayList<HierarchyDesc>(3);
+            for (int i = 0, n = this.column.length; i < n; i++) {
+                String aColumn = this.column[i];
+                HierarchyDesc aHierarchy = new HierarchyDesc();
+                aHierarchy.setLevel(String.valueOf(i + 1));
+                aHierarchy.setColumn(aColumn);
+                hierarchyList.add(aHierarchy);
+            }
+
+            this.hierarchy = hierarchyList.toArray(new HierarchyDesc[hierarchyList.size()]);
+        }
+
+        if (hierarchy != null && hierarchy.length == 0)
+            hierarchy = null;
+        if (derived != null && derived.length == 0)
+            derived = null;
+
+        if (hierarchy != null) {
+            for (HierarchyDesc h : hierarchy)
+                h.setColumn(h.getColumn().toUpperCase());
+        }
+
+        if (derived != null) {
+            StringUtil.toUpperCaseArray(derived, derived);
+        }
+        
+        if (derived != null && join == null) {
+            throw new IllegalStateException("Derived can only be defined on lookup table, cube " + cubeDesc + ", " + this);
+        }
+    }
+
     public boolean isHierarchyColumn(TblColRef col) {
         if (hierarchy == null)
             return false;
@@ -69,18 +120,27 @@ public class DimensionDesc {
         }
         return false;
     }
+    
+    public boolean isDerived() {
+        return derived != null;
+    }
 
     public boolean isHierarchy() {
         return isHierarchy;
     }
 
-    /**
-     * @return
-     */
+    public void setHierarchy(boolean isHierarchy) {
+        this.isHierarchy = isHierarchy;
+    }
+
     public String getTable() {
         return table;
     }
 
+    public void setTable(String table) {
+        this.table = table;
+    }
+
     public int getId() {
         return id;
     }
@@ -174,58 +234,4 @@ public class DimensionDesc {
         return "DimensionDesc [name=" + name + ", join=" + join + ", hierarchy=" + Arrays.toString(hierarchy) + ", table=" + table + ", column=" + Arrays.toString(column) + ", derived=" + Arrays.toString(derived) + "]";
     }
 
-    public void init(CubeDesc cubeDesc, Map<String, TableDesc> tables, Map<String, List<TableDesc>> columnTableMap, Map<String, List<String>> tableDatabaseMap) {
-        if (name != null)
-            name = name.toUpperCase();
-
-        if (table != null)
-            table = table.toUpperCase();
-
-        tableDesc = tables.get(this.getTable());
-        if (tableDesc == null)
-            throw new IllegalStateException("Can't find table " + table + " for dimension " + name);
-
-        for (LookupDesc lookup : cubeDesc.getModel().getLookups()) {
-            if (lookup.getTable().equalsIgnoreCase(this.getTable())) {
-                this.join = lookup.getJoin();
-                break;
-            }
-        }
-
-        if (isHierarchy && this.column.length > 0) {
-            List<HierarchyDesc> hierarchyList = new ArrayList<HierarchyDesc>(3);
-            for (int i = 0, n = this.column.length; i < n; i++) {
-                String aColumn = this.column[i];
-                HierarchyDesc aHierarchy = new HierarchyDesc();
-                aHierarchy.setLevel(String.valueOf(i + 1));
-                aHierarchy.setColumn(aColumn);
-                hierarchyList.add(aHierarchy);
-            }
-
-            this.hierarchy = hierarchyList.toArray(new HierarchyDesc[hierarchyList.size()]);
-        }
-
-        if (hierarchy != null && hierarchy.length == 0)
-            hierarchy = null;
-        if (derived != null && derived.length == 0)
-            derived = null;
-
-        if (hierarchy != null) {
-            for (HierarchyDesc h : hierarchy)
-                h.setColumn(h.getColumn().toUpperCase());
-        }
-
-        if (derived != null) {
-            StringUtil.toUpperCaseArray(derived, derived);
-        }
-    }
-
-    public void setHierarchy(boolean isHierarchy) {
-        this.isHierarchy = isHierarchy;
-    }
-
-    public void setTable(String table) {
-        this.table = table;
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/06955b59/examples/test_case_data/localmeta_v1/cube/test_kylin_cube_ii.json
----------------------------------------------------------------------
diff --git a/examples/test_case_data/localmeta_v1/cube/test_kylin_cube_ii.json b/examples/test_case_data/localmeta_v1/cube/test_kylin_cube_ii.json
deleted file mode 100644
index 8e8e474..0000000
--- a/examples/test_case_data/localmeta_v1/cube/test_kylin_cube_ii.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
-  "uuid" : "daa53e80-41be-49a5-89ca-9fb7294db186",
-  "name" : "test_kylin_cube_ii",
-  "owner" : null,
-  "version" : null,
-  "cost" : 10,
-  "status" : "READY",
-  "segments" : [ {
-    "name" : "19700101000000_20140901000000",
-    "status" : "READY",
-    "dictionaries" : {
-      "TEST_KYLIN_FACT/LSTG_FORMAT_NAME" : "/dict/TEST_KYLIN_FACT/LSTG_FORMAT_NAME/bd9f6b22-36ba-4e6b-92aa-0d585faf0b39.dict",
-      "TEST_KYLIN_FACT/TRANS_ID" : "/dict/TEST_KYLIN_FACT/TRANS_ID/c8d19f95-b6cd-4219-a114-54aaddcb2909.dict",
-      "TEST_KYLIN_FACT/LSTG_SITE_ID" : "/dict/TEST_KYLIN_FACT/LSTG_SITE_ID/7df5789b-0280-453c-b406-b75cad6770d1.dict",
-      "TEST_KYLIN_FACT/SLR_SEGMENT_CD" : "/dict/TEST_KYLIN_FACT/SLR_SEGMENT_CD/8300bf83-053e-48bb-8c87-88c8d483afd1.dict",
-      "TEST_KYLIN_FACT/SELLER_ID" : "/dict/TEST_KYLIN_FACT/SELLER_ID/6e285e1e-ed16-4012-9f1e-f950dd6927ce.dict",
-      "TEST_KYLIN_FACT/ITEM_COUNT" : "/dict/TEST_KYLIN_FACT/ITEM_COUNT/73c9bfe1-6496-4ff8-9467-6cbee2924c16.dict",
-      "TEST_KYLIN_FACT/CAL_DT" : "/dict/TEST_KYLIN_FACT/CAL_DT/48433f91-0d68-495f-b7f2-295414591275.dict",
-      "TEST_KYLIN_FACT/LEAF_CATEG_ID" : "/dict/TEST_KYLIN_FACT/LEAF_CATEG_ID/96b7c577-b209-45b3-a848-4d2d7af5c0cc.dict",
-      "TEST_KYLIN_FACT/PRICE" : "/dict/TEST_KYLIN_FACT/PRICE/927dde3f-6999-4434-b57c-adfa73160334.dict"
-    },
-    "snapshots" : { },
-    "storage_location_identifier" : "test_III",
-    "date_range_start" : 0,
-    "date_range_end" : 0,
-    "size_kb" : 0,
-    "source_records" : 0,
-    "source_records_size" : 0,
-    "last_build_time" : 0,
-    "last_build_job_id" : null,
-    "binary_signature" : null
-  } ],
-  "last_modified" : 1414999085798,
-  "descriptor" : "test_kylin_cube_ii",
-  "create_time" : null,
-  "size_kb" : 0,
-  "source_records_count" : 0,
-  "source_records_size" : 0
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/06955b59/invertedindex/src/main/java/com/kylinolap/invertedindex/model/IIDesc.java
----------------------------------------------------------------------
diff --git a/invertedindex/src/main/java/com/kylinolap/invertedindex/model/IIDesc.java b/invertedindex/src/main/java/com/kylinolap/invertedindex/model/IIDesc.java
index f612003..858f8d5 100644
--- a/invertedindex/src/main/java/com/kylinolap/invertedindex/model/IIDesc.java
+++ b/invertedindex/src/main/java/com/kylinolap/invertedindex/model/IIDesc.java
@@ -44,8 +44,6 @@ public class IIDesc extends RootPersistentEntity {
     private String name;
     @JsonProperty("model_name")
     private String modelName;
-    @JsonProperty("fact_table")
-    private String factTableName;
     @JsonProperty("timestamp_dimension")
     private String timestampDimension;
     @JsonProperty("bitmap_dimensions")
@@ -106,7 +104,7 @@ public class IIDesc extends RootPersistentEntity {
             }
         }
         for (String column : metricNames) {
-            TableDesc tableDesc = this.getTableDesc(this.factTableName);
+            TableDesc tableDesc = this.getTableDesc(this.getFactTableName());
             ColumnDesc columnDesc = tableDesc.findColumnByName(column);
             allColumns.add(new TblColRef(columnDesc));
             if (!allTableNames.contains(tableDesc.getIdentity())) {
@@ -120,7 +118,7 @@ public class IIDesc extends RootPersistentEntity {
         valueCols = new int[IIDimension.getColumnCount(valueDimensions)];
         metricsCols = new int[metricNames.length];
 
-        metricsColSet = new BitSet(this.getTableDesc(this.factTableName).getColumnCount());
+        metricsColSet = new BitSet(this.getTableDesc(this.getFactTableName()).getColumnCount());
         measureDescs = Lists.newArrayList();
 
         int totalIndex = 0;
@@ -134,7 +132,7 @@ public class IIDesc extends RootPersistentEntity {
             metricsCols[i] = totalIndex;
             metricsColSet.set(totalIndex);
 
-            ColumnDesc col = this.getTableDesc(this.factTableName).findColumnByName(metricNames[i]);
+            ColumnDesc col = this.getTableDesc(this.getFactTableName()).findColumnByName(metricNames[i]);
             measureDescs.add(makeMeasureDescs("SUM", col));
             measureDescs.add(makeMeasureDescs("MIN", col));
             measureDescs.add(makeMeasureDescs("MAX", col));
@@ -146,7 +144,7 @@ public class IIDesc extends RootPersistentEntity {
         for (int i = 0; i < allColumns.size(); ++i) {
             TblColRef col = allColumns.get(i);
 
-            if (col.isSameAs(this.factTableName, this.timestampDimension)) {
+            if (col.isSameAs(this.getFactTableName(), this.timestampDimension)) {
                 tsCol = i;
                 break;
             }
@@ -266,7 +264,7 @@ public class IIDesc extends RootPersistentEntity {
     }
 
     public boolean isMetricsCol(TblColRef col) {
-        if (!col.getTable().equalsIgnoreCase(this.factTableName))
+        if (!col.getTable().equalsIgnoreCase(this.getFactTableName()))
             return false;
         return isMetricsCol(this.findColumn(col));
     }
@@ -281,7 +279,7 @@ public class IIDesc extends RootPersistentEntity {
      * @return
      */
     public String getFactTableName() {
-        return factTableName.toUpperCase();
+        return this.model.getFactTable().toUpperCase();
     }
 
     public String getTimestampDimension() {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/06955b59/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3e0e270..4fcfa0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,8 +72,10 @@
         <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
         <sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
         <sonar.language>java</sonar.language>
-        <sonar.jacoco.excludes>com/kylinolap/**/tools/**:net/hydromatic/optiq/**:org/eigenbase/sql2rel/**
-        </sonar.jacoco.excludes>
+        <sonar.jacoco.excludes>com/kylinolap/**/tools/**:net/hydromatic/optiq/**:org/eigenbase/sql2rel/**</sonar.jacoco.excludes>
+        
+        <!-- Surefire -->
+        <surefire.reportsDirectory>${project.basedir}/../target/surefire-reports</surefire.reportsDirectory>
     </properties>
 
     <dependencyManagement>
@@ -545,7 +547,7 @@
                                     <value>false</value>
                                 </property>
                             </systemProperties>
-                            <argLine>-Xms1G -Xmx6G -XX:PermSize=1G -XX:MaxPermSize=2G</argLine>
+                            <argLine>${argLine} -Xms1G -Xmx6G -XX:PermSize=1G -XX:MaxPermSize=2G</argLine>
                         </configuration>
                     </plugin>