kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject kylin git commit: KYLIN-1971 refactor, retire ColumnDesc.getRef()
Date Sat, 22 Oct 2016 12:50:29 GMT
Repository: kylin
Updated Branches:
  refs/heads/master e119cc9bd -> cde08cdda


KYLIN-1971 refactor, retire ColumnDesc.getRef()


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

Branch: refs/heads/master
Commit: cde08cdda69aa00e991b2a3260f2bcb3ad9160c2
Parents: e119cc9
Author: Yang Li <liyang@apache.org>
Authored: Sat Oct 22 19:28:27 2016 +0800
Committer: Yang Li <liyang@apache.org>
Committed: Sat Oct 22 20:47:26 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/job/DeployUtil.java   | 19 ++---
 .../kylin/job/dataGen/FactTableGenerator.java   | 11 ++-
 .../kylin/cube/CubeCapabilityChecker.java       | 12 +--
 .../org/apache/kylin/cube/model/CubeDesc.java   |  5 +-
 .../kylin/cube/model/v1_4_0/CubeDesc.java       |  8 +-
 .../java/org/apache/kylin/gridtable/GTUtil.java |  4 +-
 .../metadata/filter/ColumnTupleFilter.java      | 85 ++++++++++++++------
 .../apache/kylin/metadata/model/ColumnDesc.java | 10 ---
 .../kylin/metadata/model/DataModelDesc.java     | 10 +--
 .../kylin/metadata/model/PartitionDesc.java     | 23 +-----
 .../apache/kylin/metadata/model/TableRef.java   |  6 ++
 .../apache/kylin/metadata/model/TblColRef.java  | 21 +++--
 .../apache/kylin/storage/StorageMockUtils.java  | 17 ++--
 .../storage/gtrecord/DictGridTableTest.java     | 16 ++--
 .../storage/translate/ColumnValueRangeTest.java | 22 +----
 .../apache/kylin/source/kafka/KafkaMRInput.java | 30 +++----
 .../source/kafka/TimedJsonStreamParserTest.java | 44 +++-------
 .../common/coprocessor/CoprocessorRowType.java  |  2 +-
 .../hbase/common/FuzzyValueCombinationTest.java |  4 +-
 .../TimeConditionLiteralsReplacerTest.java      |  4 +-
 .../common/coprocessor/FilterBaseTest.java      | 11 +--
 .../observer/AggregateRegionObserverTest.java   |  5 +-
 22 files changed, 159 insertions(+), 210 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java
----------------------------------------------------------------------
diff --git a/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java b/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java
index be9b2a9..4a24ad2 100644
--- a/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java
+++ b/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java
@@ -18,7 +18,13 @@
 
 package org.apache.kylin.job;
 
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
 import java.nio.ByteBuffer;
 import java.util.List;
 
@@ -37,6 +43,7 @@ import org.apache.kylin.job.streaming.StreamingTableDataGenerator;
 import org.apache.kylin.metadata.MetadataManager;
 import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.TableDesc;
+import org.apache.kylin.metadata.model.TableRef;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.apache.kylin.source.hive.HiveClient;
 import org.apache.kylin.source.hive.HiveCmdBuilder;
@@ -48,9 +55,6 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.Lists;
 
-import kafka.message.Message;
-import kafka.message.MessageAndOffset;
-
 public class DeployUtil {
     private static final Logger logger = LoggerFactory.getLogger(DeployUtil.class);
 
@@ -146,16 +150,13 @@ public class DeployUtil {
     public static void prepareTestDataForStreamingCube(long startTime, long endTime, int numberOfRecords, String cubeName, StreamDataLoader streamDataLoader) throws IOException {
         CubeInstance cubeInstance = CubeManager.getInstance(KylinConfig.getInstanceFromEnv()).getCube(cubeName);
         List<String> data = StreamingTableDataGenerator.generate(numberOfRecords, startTime, endTime, cubeInstance.getFactTable());
-        TableDesc tableDesc = cubeInstance.getFactTableDesc();
         //load into kafka
         streamDataLoader.loadIntoKafka(data);
         logger.info("Write {} messages into {}", data.size(), streamDataLoader.toString());
 
         //csv data for H2 use
-        List<TblColRef> tableColumns = Lists.newArrayList();
-        for (ColumnDesc columnDesc : tableDesc.getColumns()) {
-            tableColumns.add(columnDesc.getRef());
-        }
+        TableRef factTable = cubeInstance.getDataModelDesc().getFactTableRef();
+        List<TblColRef> tableColumns = Lists.newArrayList(factTable.getColumns());
         TimedJsonStreamParser timedJsonStreamParser = new TimedJsonStreamParser(tableColumns, null);
         StringBuilder sb = new StringBuilder();
         for (String json : data) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/assembly/src/test/java/org/apache/kylin/job/dataGen/FactTableGenerator.java
----------------------------------------------------------------------
diff --git a/assembly/src/test/java/org/apache/kylin/job/dataGen/FactTableGenerator.java b/assembly/src/test/java/org/apache/kylin/job/dataGen/FactTableGenerator.java
index 5aac4de..ce5d8c4 100644
--- a/assembly/src/test/java/org/apache/kylin/job/dataGen/FactTableGenerator.java
+++ b/assembly/src/test/java/org/apache/kylin/job/dataGen/FactTableGenerator.java
@@ -555,14 +555,13 @@ public class FactTableGenerator {
     }
 
     private LinkedList<String> createRow(TreeMap<String, String> factTableCol2LookupCol, TreeSet<String> usedCols, TreeSet<String> defaultColumns) throws Exception {
-        KylinConfig config = KylinConfig.getInstanceFromEnv();
         LinkedList<String> columnValues = new LinkedList<String>();
 
         long currentRowTime = -1;
 
-        for (ColumnDesc cDesc : MetadataManager.getInstance(config).getTableDesc(factTableName).getColumns()) {
+        for (TblColRef col : cube.getDataModelDesc().getFactTableRef().getColumns()) {
 
-            String colName = cDesc.getName();
+            String colName = col.getName();
 
             if (factTableCol2LookupCol.containsKey(colName)) {
 
@@ -572,15 +571,15 @@ public class FactTableGenerator {
                 columnValues.add(candidates.get(r.nextInt(candidates.size())));
             } else if (usedCols.contains(colName)) {
                 // if the current column is a metric or dimension column in fact table
-                columnValues.add(createCell(cDesc));
+                columnValues.add(createCell(col.getColumnDesc()));
             } else {
 
                 // otherwise this column is not useful in OLAP
-                columnValues.add(createDefaultsCell(cDesc.getTypeName()));
+                columnValues.add(createDefaultsCell(col.getColumnDesc().getTypeName()));
                 defaultColumns.add(colName);
             }
 
-            if (cDesc.getRef().equals(this.cube.getDescriptor().getModel().getPartitionDesc().getPartitionDateColumnRef())) {
+            if (col.equals(cube.getDataModelDesc().getPartitionDesc().getPartitionDateColumnRef())) {
                 currentRowTime = format.parse(columnValues.get(columnValues.size() - 1)).getTime();
             }
         }

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java
index 1eada16..24f15e0 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java
@@ -25,22 +25,18 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.cube.model.CubeDesc;
 import org.apache.kylin.measure.MeasureType;
 import org.apache.kylin.measure.basic.BasicMeasureType;
-import org.apache.kylin.metadata.MetadataManager;
 import org.apache.kylin.metadata.filter.UDF.MassInTupleFilter;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.FunctionDesc;
 import org.apache.kylin.metadata.model.IStorageAware;
 import org.apache.kylin.metadata.model.MeasureDesc;
 import org.apache.kylin.metadata.model.ParameterDesc;
-import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.apache.kylin.metadata.realization.CapabilityResult;
-import org.apache.kylin.metadata.realization.SQLDigest;
 import org.apache.kylin.metadata.realization.CapabilityResult.CapabilityInfluence;
+import org.apache.kylin.metadata.realization.SQLDigest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -82,11 +78,7 @@ public class CubeCapabilityChecker {
             } else {
                 //deal with query on lookup table, like https://issues.apache.org/jira/browse/KYLIN-2030
                 if (cube.getSegments().get(0).getSnapshots().containsKey(digest.factTable)) {
-                    TableDesc tableDesc = MetadataManager.getInstance(KylinConfig.getInstanceFromEnv()).getTableDesc(digest.factTable);
-                    Set<TblColRef> dimCols = Sets.newHashSet();
-                    for (ColumnDesc columnDesc : tableDesc.getColumns()) {
-                        dimCols.add(columnDesc.getRef());
-                    }
+                    Set<TblColRef> dimCols = Sets.newHashSet(cube.getDataModelDesc().getFactTableRef().getColumns());
                     tryDimensionAsMeasures(unmatchedAggregations, digest, cube, result, dimCols);
                 } else {
                     logger.info("Skip tryDimensionAsMeasures because current cube {} does not touch lookup table {} at all", cube.getName(), digest.factTable);

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java b/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
index bfb51d0..5c73f21 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
@@ -61,7 +61,6 @@ import org.apache.kylin.metadata.model.IStorageAware;
 import org.apache.kylin.metadata.model.JoinDesc;
 import org.apache.kylin.metadata.model.MeasureDesc;
 import org.apache.kylin.metadata.model.TableDesc;
-import org.apache.kylin.metadata.model.TableRef;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -785,9 +784,7 @@ public class CubeDesc extends RootPersistentEntity implements IEngineAware {
     }
 
     private TblColRef initDimensionColRef(DimensionDesc dim, String colName) {
-        TableRef table = dim.getTableRef();
-        TblColRef col = table.getColumn(colName);
-        checkArgument(col != null, "No column '%s' found in table %s", colName, table);
+        TblColRef col = model.findColumn(dim.getTable(), colName);
 
         // always use FK instead PK, FK could be shared by more than one lookup tables
         JoinDesc join = dim.getJoin();

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-cube/src/main/java/org/apache/kylin/cube/model/v1_4_0/CubeDesc.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/model/v1_4_0/CubeDesc.java b/core-cube/src/main/java/org/apache/kylin/cube/model/v1_4_0/CubeDesc.java
index 24c9ceb..fb2998a 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/model/v1_4_0/CubeDesc.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/model/v1_4_0/CubeDesc.java
@@ -44,7 +44,6 @@ import org.apache.kylin.common.util.CaseInsensitiveStringMap;
 import org.apache.kylin.common.util.JsonUtil;
 import org.apache.kylin.metadata.MetadataConstants;
 import org.apache.kylin.metadata.MetadataManager;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.DataModelDesc;
 import org.apache.kylin.metadata.model.FunctionDesc;
 import org.apache.kylin.metadata.model.IEngineAware;
@@ -607,12 +606,7 @@ public class CubeDesc extends RootPersistentEntity {
     }
 
     private TblColRef initDimensionColRef(DimensionDesc dim, String colName) {
-        TableDesc table = dim.getTableDesc();
-        ColumnDesc col = table.findColumnByName(colName);
-        if (col == null)
-            throw new IllegalArgumentException("No column '" + colName + "' found in table " + table);
-
-        TblColRef ref = col.getRef();
+        TblColRef ref = model.findColumn(dim.getTable(), colName);
 
         // always use FK instead PK, FK could be shared by more than one lookup tables
         JoinDesc join = dim.getJoin();

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-cube/src/main/java/org/apache/kylin/gridtable/GTUtil.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/gridtable/GTUtil.java b/core-cube/src/main/java/org/apache/kylin/gridtable/GTUtil.java
index 8d310a3..a4e574c 100644
--- a/core-cube/src/main/java/org/apache/kylin/gridtable/GTUtil.java
+++ b/core-cube/src/main/java/org/apache/kylin/gridtable/GTUtil.java
@@ -31,7 +31,6 @@ import org.apache.kylin.metadata.filter.ConstantTupleFilter;
 import org.apache.kylin.metadata.filter.IFilterCodeSystem;
 import org.apache.kylin.metadata.filter.TupleFilter;
 import org.apache.kylin.metadata.filter.TupleFilterSerializer;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TblColRef;
 
@@ -42,8 +41,7 @@ public class GTUtil {
     static final TableDesc MOCKUP_TABLE = TableDesc.mockup("GT_MOCKUP_TABLE");
 
     static TblColRef tblColRef(int col, String datatype) {
-        ColumnDesc desc = ColumnDesc.mockup(MOCKUP_TABLE, col + 1, "" + col, datatype);
-        return desc.getRef();
+        return TblColRef.mockup(MOCKUP_TABLE, col + 1, "" + col, datatype);
     }
 
     public static byte[] serializeGTFilter(TupleFilter gtFilter, GTInfo info) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ColumnTupleFilter.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ColumnTupleFilter.java b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ColumnTupleFilter.java
index 8c5e989..c8a8f07 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ColumnTupleFilter.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/ColumnTupleFilter.java
@@ -24,9 +24,13 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.util.BytesUtil;
+import org.apache.kylin.metadata.MetadataManager;
 import org.apache.kylin.metadata.model.ColumnDesc;
+import org.apache.kylin.metadata.model.DataModelDesc;
 import org.apache.kylin.metadata.model.TableDesc;
+import org.apache.kylin.metadata.model.TableRef;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.apache.kylin.metadata.tuple.IEvaluatableTuple;
 
@@ -37,6 +41,8 @@ import org.apache.kylin.metadata.tuple.IEvaluatableTuple;
  */
 public class ColumnTupleFilter extends TupleFilter {
 
+    private static final String _QUALIFIED_ = "_QUALIFIED_";
+    
     private TblColRef columnRef;
     private Object tupleValue;
     private List<Object> values;
@@ -85,36 +91,67 @@ public class ColumnTupleFilter extends TupleFilter {
 
     @Override
     public void serialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {
-        String table = columnRef.getTable();
-        BytesUtil.writeUTFString(table, buffer);
-
-        String columnId = columnRef.getColumnDesc().getId();
-        BytesUtil.writeUTFString(columnId, buffer);
-
-        String columnName = columnRef.getName();
-        BytesUtil.writeUTFString(columnName, buffer);
-
-        String dataType = columnRef.getDatatype();
-        BytesUtil.writeUTFString(dataType, buffer);
+        TableRef tableRef = columnRef.getTableRef();
+        
+        if (tableRef == null) {
+            // un-qualified column
+            String table = columnRef.getTable();
+            BytesUtil.writeUTFString(table, buffer);
+
+            String columnId = columnRef.getColumnDesc().getId();
+            BytesUtil.writeUTFString(columnId, buffer);
+
+            String columnName = columnRef.getName();
+            BytesUtil.writeUTFString(columnName, buffer);
+
+            String dataType = columnRef.getDatatype();
+            BytesUtil.writeUTFString(dataType, buffer);
+        } else {
+            // qualified column (from model)
+            BytesUtil.writeUTFString(_QUALIFIED_, buffer);
+            
+            String model = tableRef.getModel().getName();
+            BytesUtil.writeUTFString(model, buffer);
+            
+            String alias = tableRef.getAlias();
+            BytesUtil.writeUTFString(alias, buffer);
+            
+            String col = columnRef.getName();
+            BytesUtil.writeUTFString(col, buffer);
+        }
     }
 
     @Override
     public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {
 
-        TableDesc table = null;
-        ColumnDesc column = new ColumnDesc();
-
         String tableName = BytesUtil.readUTFString(buffer);
-        if (tableName != null) {
-            table = new TableDesc();
-            table.setName(tableName);
+        
+        if (_QUALIFIED_.equals(tableName)) {
+            // qualified column (from model)
+            String model = BytesUtil.readUTFString(buffer);
+            String alias = BytesUtil.readUTFString(buffer);
+            String col = BytesUtil.readUTFString(buffer);
+            
+            KylinConfig config = KylinConfig.getInstanceFromEnv();
+            DataModelDesc modelDesc = MetadataManager.getInstance(config).getDataModelDesc(model);
+            this.columnRef = modelDesc.findColumn(alias, col);
+            
+        } else {
+            // un-qualified column
+            TableDesc tableDesc = null;
+
+            if (tableName != null) {
+                tableDesc = new TableDesc();
+                tableDesc.setName(tableName);
+            }
+
+            ColumnDesc column = new ColumnDesc();
+            column.setId(BytesUtil.readUTFString(buffer));
+            column.setName(BytesUtil.readUTFString(buffer));
+            column.setDatatype(BytesUtil.readUTFString(buffer));
+            column.init(tableDesc);
+
+            this.columnRef = column.getRef();
         }
-
-        column.setId(BytesUtil.readUTFString(buffer));
-        column.setName(BytesUtil.readUTFString(buffer));
-        column.setDatatype(BytesUtil.readUTFString(buffer));
-        column.init(table);
-
-        this.columnRef = column.getRef();
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
index d131b92..1b19b50 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
@@ -36,16 +36,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 @JsonAutoDetect(fieldVisibility = Visibility.NONE, getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
 public class ColumnDesc implements Serializable {
 
-    public static ColumnDesc mockup(TableDesc table, int oneBasedColumnIndex, String name, String datatype) {
-        ColumnDesc desc = new ColumnDesc();
-        String id = "" + oneBasedColumnIndex;
-        desc.setId(id);
-        desc.setName(name);
-        desc.setDatatype(datatype);
-        desc.init(table);
-        return desc;
-    }
-
     @JsonProperty("id")
     private String id;
     @JsonProperty("name")

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
index d1df410..0d37bb8 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
@@ -263,9 +263,9 @@ public class DataModelDesc extends RootPersistentEntity {
         tableNameMap.clear();
         
         initTableAlias(tables);
-        initJoinColumns(tables);
+        initJoinColumns();
         ModelDimensionDesc.capicalizeStrings(dimensions);
-        initPartitionDesc(tables);
+        initPartitionDesc();
     }
 
     private void initTableAlias(Map<String, TableDesc> tables) {
@@ -315,12 +315,12 @@ public class DataModelDesc extends RootPersistentEntity {
         }
     }
 
-    private void initPartitionDesc(Map<String, TableDesc> tables) {
+    private void initPartitionDesc() {
         if (this.partitionDesc != null)
-            this.partitionDesc.init(tables);
+            this.partitionDesc.init(this);
     }
 
-    private void initJoinColumns(Map<String, TableDesc> tables) {
+    private void initJoinColumns() {
         for (LookupDesc lookup : this.lookups) {
             TableRef dimTable = lookup.getTableRef();
             JoinDesc join = lookup.getJoin();

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java
index 6487bfa..1006b83 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java
@@ -23,7 +23,6 @@ import java.util.Map;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.kylin.common.util.ClassUtil;
 import org.apache.kylin.common.util.DateFormat;
-import org.apache.kylin.common.util.StringSplitter;
 import org.apache.kylin.metadata.datatype.DataType;
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
@@ -31,8 +30,6 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 /**
- * @author xduo
- * 
  */
 @JsonAutoDetect(fieldVisibility = Visibility.NONE, getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
 public class PartitionDesc {
@@ -66,28 +63,12 @@ public class PartitionDesc {
     private TblColRef partitionDateColumnRef;
     private IPartitionConditionBuilder partitionConditionBuilder;
 
-    public void init(Map<String, TableDesc> tables) {
+    public void init(DataModelDesc model) {
         if (StringUtils.isEmpty(partitionDateColumn))
             return;
 
         partitionDateColumn = partitionDateColumn.toUpperCase();
-
-        String[] columns = StringSplitter.split(partitionDateColumn, ".");
-
-        if (null != columns && columns.length == 3) {
-            String tableName = columns[0].toUpperCase() + "." + columns[1].toUpperCase();
-
-            TableDesc table = tables.get(tableName);
-            ColumnDesc col = table.findColumnByName(columns[2]);
-            if (col != null) {
-                partitionDateColumnRef = new TblColRef(col);
-            } else {
-                throw new IllegalStateException("The column '" + partitionDateColumn + "' provided in 'partition_date_column' doesn't exist.");
-            }
-        } else {
-            throw new IllegalStateException("The 'partition_date_column' format is invalid: " + partitionDateColumn + ", it should be {db}.{table}.{column}.");
-        }
-
+        partitionDateColumnRef = model.findColumn(partitionDateColumn);
         partitionConditionBuilder = (IPartitionConditionBuilder) ClassUtil.newInstance(partitionConditionBuilderClz);
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java
index 626fb16..975094c 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java
@@ -18,6 +18,8 @@
 
 package org.apache.kylin.metadata.model;
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
 
 import com.google.common.collect.Maps;
@@ -64,6 +66,10 @@ public class TableRef {
         return columns.get(name);
     }
     
+    public Collection<TblColRef> getColumns() {
+        return Collections.unmodifiableCollection(columns.values());
+    }
+    
     @Override
     public boolean equals(Object o) {
         if (this == o)

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
index 0f3f70d..5f0fe94 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
@@ -61,6 +61,17 @@ public class TblColRef implements Serializable {
         return colRef;
     }
 
+    // for test only
+    public static TblColRef mockup(TableDesc table, int oneBasedColumnIndex, String name, String datatype) {
+        ColumnDesc desc = new ColumnDesc();
+        String id = "" + oneBasedColumnIndex;
+        desc.setId(id);
+        desc.setName(name);
+        desc.setDatatype(datatype);
+        desc.init(table);
+        return new TblColRef(desc);
+    }
+    
     // ============================================================================
 
     private TableRef table;
@@ -74,19 +85,19 @@ public class TblColRef implements Serializable {
         this.table = table;
         this.column = column;
     }
-
+    
     public ColumnDesc getColumnDesc() {
         return column;
     }
 
-    public void setColumn(ColumnDesc column) {
-        this.column = column;
-    }
-
     public String getName() {
         return column.getName();
     }
 
+    public TableRef getTableRef() {
+        return table;
+    }
+    
     public String getTable() {
         if (column.getTable() == null) {
             return null;

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-storage/src/test/java/org/apache/kylin/storage/StorageMockUtils.java
----------------------------------------------------------------------
diff --git a/core-storage/src/test/java/org/apache/kylin/storage/StorageMockUtils.java b/core-storage/src/test/java/org/apache/kylin/storage/StorageMockUtils.java
index 6e54899..456e768 100644
--- a/core-storage/src/test/java/org/apache/kylin/storage/StorageMockUtils.java
+++ b/core-storage/src/test/java/org/apache/kylin/storage/StorageMockUtils.java
@@ -28,7 +28,6 @@ import org.apache.kylin.metadata.filter.CompareTupleFilter;
 import org.apache.kylin.metadata.filter.ConstantTupleFilter;
 import org.apache.kylin.metadata.filter.LogicalTupleFilter;
 import org.apache.kylin.metadata.filter.TupleFilter;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.FunctionDesc;
 import org.apache.kylin.metadata.model.ParameterDesc;
 import org.apache.kylin.metadata.model.TableDesc;
@@ -61,14 +60,12 @@ public class StorageMockUtils {
         List<TblColRef> groups = new ArrayList<TblColRef>();
 
         TableDesc t1 = TableDesc.mockup("DEFAULT.TEST_KYLIN_FACT");
-        ColumnDesc c1 = ColumnDesc.mockup(t1, 2, "CAL_DT", "date");
-        TblColRef cf1 = c1.getRef();
-        groups.add(cf1);
+        TblColRef c1 = TblColRef.mockup(t1, 2, "CAL_DT", "date");
+        groups.add(c1);
 
         TableDesc t2 = TableDesc.mockup("DEFAULT.TEST_CATEGORY_GROUPINGS");
-        ColumnDesc c2 = ColumnDesc.mockup(t2, 14, "META_CATEG_NAME", "string");
-        TblColRef cf2 = c2.getRef();
-        groups.add(cf2);
+        TblColRef c2 = TblColRef.mockup(t2, 14, "META_CATEG_NAME", "string");
+        groups.add(c2);
 
         return groups;
     }
@@ -77,7 +74,7 @@ public class StorageMockUtils {
         List<FunctionDesc> functions = new ArrayList<FunctionDesc>();
 
         TableDesc t1 = TableDesc.mockup("DEFAULT.TEST_KYLIN_FACT");
-        TblColRef priceCol = ColumnDesc.mockup(t1, 7, "PRICE", "decimal(19,4)").getRef();
+        TblColRef priceCol = TblColRef.mockup(t1, 7, "PRICE", "decimal(19,4)");
 
         FunctionDesc f1 = new FunctionDesc();
         f1.setExpression("SUM");
@@ -96,8 +93,8 @@ public class StorageMockUtils {
         List<FunctionDesc> functions = new ArrayList<FunctionDesc>();
 
         TableDesc t1 = TableDesc.mockup("DEFAULT.TEST_KYLIN_FACT");
-        TblColRef priceCol = ColumnDesc.mockup(t1, 7, "PRICE", "decimal(19,4)").getRef();
-        TblColRef sellerCol = ColumnDesc.mockup(t1, 9, "SELLER_ID", "bigint").getRef();
+        TblColRef priceCol = TblColRef.mockup(t1, 7, "PRICE", "decimal(19,4)");
+        TblColRef sellerCol = TblColRef.mockup(t1, 9, "SELLER_ID", "bigint");
 
         FunctionDesc f1 = new FunctionDesc();
         f1.setExpression("SUM");

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java
----------------------------------------------------------------------
diff --git a/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java b/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java
index 0cdfa7e..d40eb08 100644
--- a/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java
+++ b/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java
@@ -360,8 +360,8 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
         GTInfo info = table.getInfo();
 
         TableDesc extTable = TableDesc.mockup("ext");
-        TblColRef extColA = ColumnDesc.mockup(extTable, 1, "A", "timestamp").getRef();
-        TblColRef extColB = ColumnDesc.mockup(extTable, 2, "B", "integer").getRef();
+        TblColRef extColA = TblColRef.mockup(extTable, 1, "A", "timestamp");
+        TblColRef extColB = TblColRef.mockup(extTable, 2, "B", "integer");
 
         CompareTupleFilter fComp1 = compare(extColA, FilterOperatorEnum.GT, "2015-01-14");
         CompareTupleFilter fComp2 = compare(extColB, FilterOperatorEnum.EQ, "10");
@@ -380,8 +380,8 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
         GTInfo info = table.getInfo();
 
         TableDesc extTable = TableDesc.mockup("ext");
-        TblColRef extColA = ColumnDesc.mockup(extTable, 1, "A", "timestamp").getRef();
-        TblColRef extColB = ColumnDesc.mockup(extTable, 2, "B", "integer").getRef();
+        TblColRef extColA = TblColRef.mockup(extTable, 1, "A", "timestamp");
+        TblColRef extColB = TblColRef.mockup(extTable, 2, "B", "integer");
 
         CompareTupleFilter fComp1 = compare(extColA, FilterOperatorEnum.GT, "2015-01-14");
         CompareTupleFilter fComp2 = compare(extColB, FilterOperatorEnum.LT, "9");
@@ -401,8 +401,8 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
         GTInfo info = table.getInfo();
 
         TableDesc extTable = TableDesc.mockup("ext");
-        TblColRef extColA = ColumnDesc.mockup(extTable, 1, "A", "timestamp").getRef();
-        TblColRef extColB = ColumnDesc.mockup(extTable, 2, "B", "integer").getRef();
+        TblColRef extColA = TblColRef.mockup(extTable, 1, "A", "timestamp");
+        TblColRef extColB = TblColRef.mockup(extTable, 2, "B", "integer");
 
         CompareTupleFilter fComp1 = compare(extColA, FilterOperatorEnum.GT, "2015-01-14");
         CompareTupleFilter fComp2 = compare(extColB, FilterOperatorEnum.LTE, "9");
@@ -422,8 +422,8 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
         GTInfo info = table.getInfo();
 
         TableDesc extTable = TableDesc.mockup("ext");
-        TblColRef extColA = ColumnDesc.mockup(extTable, 1, "A", "timestamp").getRef();
-        TblColRef extColB = ColumnDesc.mockup(extTable, 2, "B", "integer").getRef();
+        TblColRef extColA = TblColRef.mockup(extTable, 1, "A", "timestamp");
+        TblColRef extColB = TblColRef.mockup(extTable, 2, "B", "integer");
 
         CompareTupleFilter fComp1 = compare(extColA, FilterOperatorEnum.GT, "2015-01-14");
         CompareTupleFilter fComp2 = compare(extColB, FilterOperatorEnum.IN, "9", "10", "15");

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/core-storage/src/test/java/org/apache/kylin/storage/translate/ColumnValueRangeTest.java
----------------------------------------------------------------------
diff --git a/core-storage/src/test/java/org/apache/kylin/storage/translate/ColumnValueRangeTest.java b/core-storage/src/test/java/org/apache/kylin/storage/translate/ColumnValueRangeTest.java
index 36d9ea6..0e7e91f 100644
--- a/core-storage/src/test/java/org/apache/kylin/storage/translate/ColumnValueRangeTest.java
+++ b/core-storage/src/test/java/org/apache/kylin/storage/translate/ColumnValueRangeTest.java
@@ -30,7 +30,6 @@ import org.apache.kylin.common.util.LocalFileMetadataTestCase;
 import org.apache.kylin.dict.StringBytesConverter;
 import org.apache.kylin.dict.TrieDictionaryBuilder;
 import org.apache.kylin.metadata.filter.TupleFilter.FilterOperatorEnum;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.junit.AfterClass;
@@ -121,24 +120,7 @@ public class ColumnValueRangeTest extends LocalFileMetadataTestCase {
     }
 
     public static TblColRef mockupTblColRef() {
-        TableDesc t = mockupTableDesc("table_a");
-        ColumnDesc c = mockupColumnDesc(t, 1, "col_1", "string");
-        return c.getRef();
-    }
-
-    private static TableDesc mockupTableDesc(String tableName) {
-        TableDesc mockup = new TableDesc();
-        mockup.setName(tableName);
-        return mockup;
-    }
-
-    private static ColumnDesc mockupColumnDesc(TableDesc table, int oneBasedColumnIndex, String name, String datatype) {
-        ColumnDesc desc = new ColumnDesc();
-        String id = "" + oneBasedColumnIndex;
-        desc.setId(id);
-        desc.setName(name);
-        desc.setDatatype(datatype);
-        desc.init(table);
-        return desc;
+        TableDesc t = TableDesc.mockup("table_a");
+        return TblColRef.mockup(t, 1, "col_1", "string");
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaMRInput.java
----------------------------------------------------------------------
diff --git a/source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaMRInput.java b/source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaMRInput.java
index 4d1f5c9..54d8c92 100644
--- a/source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaMRInput.java
+++ b/source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaMRInput.java
@@ -17,10 +17,10 @@
 */
 package org.apache.kylin.source.kafka;
 
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import org.apache.kylin.metadata.model.ISegment;
-import org.apache.kylin.source.kafka.hadoop.KafkaFlatTableJob;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapreduce.Job;
@@ -38,20 +38,18 @@ import org.apache.kylin.engine.mr.steps.CubingExecutableUtil;
 import org.apache.kylin.job.JoinedFlatTable;
 import org.apache.kylin.job.engine.JobEngineConfig;
 import org.apache.kylin.job.execution.DefaultChainedExecutable;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.IJoinedFlatTableDesc;
+import org.apache.kylin.metadata.model.ISegment;
 import org.apache.kylin.metadata.model.TableDesc;
+import org.apache.kylin.metadata.model.TableRef;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.apache.kylin.source.kafka.config.KafkaConfig;
+import org.apache.kylin.source.kafka.hadoop.KafkaFlatTableJob;
 import org.apache.kylin.source.kafka.job.MergeOffsetStep;
 import org.apache.kylin.source.kafka.job.SeekOffsetStep;
 import org.apache.kylin.source.kafka.job.UpdateTimeRangeStep;
 
-import javax.annotation.Nullable;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.List;
+import com.google.common.collect.Lists;
 
 public class KafkaMRInput implements IMRInput {
 
@@ -59,7 +57,7 @@ public class KafkaMRInput implements IMRInput {
 
     @Override
     public IMRBatchCubingInputSide getBatchCubingInputSide(IJoinedFlatTableDesc flatDesc) {
-        this.cubeSegment = (CubeSegment)flatDesc.getSegment();
+        this.cubeSegment = (CubeSegment) flatDesc.getSegment();
         return new BatchCubingInputSide(cubeSegment);
     }
 
@@ -67,14 +65,8 @@ public class KafkaMRInput implements IMRInput {
     public IMRTableInputFormat getTableInputFormat(TableDesc table) {
         KafkaConfigManager kafkaConfigManager = KafkaConfigManager.getInstance(KylinConfig.getInstanceFromEnv());
         KafkaConfig kafkaConfig = kafkaConfigManager.getKafkaConfig(table.getIdentity());
-        List<TblColRef> columns = Lists.transform(Arrays.asList(table.getColumns()), new Function<ColumnDesc, TblColRef>() {
-            @Nullable
-            @Override
-            public TblColRef apply(ColumnDesc input) {
-                return input.getRef();
-            }
-        });
-
+        TableRef tableRef = cubeSegment.getCubeInstance().getDataModelDesc().findTable(table.getIdentity());
+        List<TblColRef> columns = Lists.newArrayList(tableRef.getColumns());
         return new KafkaTableInputFormat(cubeSegment, columns, kafkaConfig, null);
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/source-kafka/src/test/java/org/apache/kylin/source/kafka/TimedJsonStreamParserTest.java
----------------------------------------------------------------------
diff --git a/source-kafka/src/test/java/org/apache/kylin/source/kafka/TimedJsonStreamParserTest.java b/source-kafka/src/test/java/org/apache/kylin/source/kafka/TimedJsonStreamParserTest.java
index f92a24e..230ff00 100644
--- a/source-kafka/src/test/java/org/apache/kylin/source/kafka/TimedJsonStreamParserTest.java
+++ b/source-kafka/src/test/java/org/apache/kylin/source/kafka/TimedJsonStreamParserTest.java
@@ -17,32 +17,28 @@
  */
 package org.apache.kylin.source.kafka;
 
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static org.junit.Assert.assertEquals;
 
 import java.io.File;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
 
-import com.fasterxml.jackson.databind.type.MapType;
-import com.fasterxml.jackson.databind.type.SimpleType;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
 import org.apache.kylin.common.util.StreamingMessage;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TblColRef;
-
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.util.List;
-import java.util.HashMap;
-import java.util.ArrayList;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.MapType;
+import com.fasterxml.jackson.databind.type.SimpleType;
 
 public class TimedJsonStreamParserTest extends LocalFileMetadataTestCase {
 
@@ -139,28 +135,12 @@ public class TimedJsonStreamParserTest extends LocalFileMetadataTestCase {
     }
 
     private static List<TblColRef> mockupTblColRefList() {
-        TableDesc t = mockupTableDesc("table_a");
+        TableDesc t = TableDesc.mockup("table_a");
         List<TblColRef> list = new ArrayList<>();
         for (int i = 0; i < userNeedColNames.length; i++) {
-            ColumnDesc c = mockupColumnDesc(t, i, userNeedColNames[i], "string");
-            list.add(c.getRef());
+            TblColRef c = TblColRef.mockup(t, i, userNeedColNames[i], "string");
+            list.add(c);
         }
         return list;
     }
-
-    private static TableDesc mockupTableDesc(String tableName) {
-        TableDesc mockup = new TableDesc();
-        mockup.setName(tableName);
-        return mockup;
-    }
-
-    private static ColumnDesc mockupColumnDesc(TableDesc table, int oneBasedColumnIndex, String name, String datatype) {
-        ColumnDesc desc = new ColumnDesc();
-        String id = "" + oneBasedColumnIndex;
-        desc.setId(id);
-        desc.setName(name);
-        desc.setDatatype(datatype);
-        desc.init(table);
-        return desc;
-    }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/CoprocessorRowType.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/CoprocessorRowType.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/CoprocessorRowType.java
index d47bf61..f1e26f5 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/CoprocessorRowType.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/CoprocessorRowType.java
@@ -36,9 +36,9 @@ import com.google.common.collect.Maps;
 /**
  * @author yangli9
  */
+@Deprecated // used by v1 HBase coprocessor
 public class CoprocessorRowType {
 
-
     //for observer
     public static CoprocessorRowType fromCuboid(CubeSegment seg, Cuboid cuboid) {
         List<TblColRef> colList = cuboid.getColumns();

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/FuzzyValueCombinationTest.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/FuzzyValueCombinationTest.java b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/FuzzyValueCombinationTest.java
index e516bc2..14c14ba 100644
--- a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/FuzzyValueCombinationTest.java
+++ b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/FuzzyValueCombinationTest.java
@@ -27,7 +27,6 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.kylin.common.util.LocalFileMetadataTestCase;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.apache.kylin.storage.translate.FuzzyValueCombination;
@@ -67,8 +66,7 @@ public class FuzzyValueCombinationTest extends LocalFileMetadataTestCase {
     }
 
     private static TblColRef col(int i, TableDesc t) {
-        ColumnDesc col = ColumnDesc.mockup(t, i, "Col" + i, "string");
-        return col.getRef();
+        return TblColRef.mockup(t, i, "Col" + i, "string");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/TimeConditionLiteralsReplacerTest.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/TimeConditionLiteralsReplacerTest.java b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/TimeConditionLiteralsReplacerTest.java
index 29e83b7..63f8961 100644
--- a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/TimeConditionLiteralsReplacerTest.java
+++ b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/TimeConditionLiteralsReplacerTest.java
@@ -25,7 +25,6 @@ import org.apache.kylin.metadata.filter.ConstantTupleFilter;
 import org.apache.kylin.metadata.filter.TimeConditionLiteralsReplacer;
 import org.apache.kylin.metadata.filter.TupleFilter;
 import org.apache.kylin.metadata.filter.TupleFilterSerializer;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.apache.kylin.storage.hbase.common.coprocessor.FilterBaseTest;
@@ -38,8 +37,7 @@ public class TimeConditionLiteralsReplacerTest extends FilterBaseTest {
     @Test
     public void basicTest() {
         TableDesc t1 = TableDesc.mockup("DEFAULT.TEST_KYLIN_FACT");
-        ColumnDesc c1 = ColumnDesc.mockup(t1, 2, "CAL_DT", "date");
-        TblColRef column = c1.getRef();
+        TblColRef column = TblColRef.mockup(t1, 2, "CAL_DT", "date");
 
         CompareTupleFilter compareFilter = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.EQ);
         ColumnTupleFilter columnFilter = new ColumnTupleFilter(column);

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterBaseTest.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterBaseTest.java b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterBaseTest.java
index 1310478..d016e4f 100644
--- a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterBaseTest.java
+++ b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterBaseTest.java
@@ -38,7 +38,6 @@ import org.apache.kylin.metadata.filter.LogicalTupleFilter;
 import org.apache.kylin.metadata.filter.StringCodeSystem;
 import org.apache.kylin.metadata.filter.TupleFilter;
 import org.apache.kylin.metadata.filter.TupleFilter.FilterOperatorEnum;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.apache.kylin.metadata.tuple.Tuple;
@@ -71,14 +70,12 @@ public class FilterBaseTest extends LocalFileMetadataTestCase {
         List<TblColRef> groups = new ArrayList<TblColRef>();
 
         TableDesc t1 = TableDesc.mockup("DEFAULT.TEST_KYLIN_FACT");
-        ColumnDesc c1 = ColumnDesc.mockup(t1, 2, "CAL_DT", "string");
-        TblColRef cf1 = c1.getRef();
-        groups.add(cf1);
+        TblColRef c1 = TblColRef.mockup(t1, 2, "CAL_DT", "string");
+        groups.add(c1);
 
         TableDesc t2 = TableDesc.mockup("DEFAULT.TEST_CATEGORY_GROUPINGS");
-        ColumnDesc c2 = ColumnDesc.mockup(t2, 14, "META_CATEG_NAME", "string");
-        TblColRef cf2 = c2.getRef();
-        groups.add(cf2);
+        TblColRef c2 = TblColRef.mockup(t2, 14, "META_CATEG_NAME", "string");
+        groups.add(c2);
 
         return groups;
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/cde08cdd/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/v1/coprocessor/observer/AggregateRegionObserverTest.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/v1/coprocessor/observer/AggregateRegionObserverTest.java b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/v1/coprocessor/observer/AggregateRegionObserverTest.java
index 390930a..c25b690 100644
--- a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/v1/coprocessor/observer/AggregateRegionObserverTest.java
+++ b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/v1/coprocessor/observer/AggregateRegionObserverTest.java
@@ -36,11 +36,10 @@ import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.KeyValue.Type;
 import org.apache.hadoop.hbase.regionserver.RegionScanner;
 import org.apache.kylin.common.util.Bytes;
+import org.apache.kylin.gridtable.StorageSideBehavior;
 import org.apache.kylin.metadata.datatype.LongMutable;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TblColRef;
-import org.apache.kylin.gridtable.StorageSideBehavior;
 import org.apache.kylin.storage.hbase.common.coprocessor.CoprocessorFilter;
 import org.apache.kylin.storage.hbase.common.coprocessor.CoprocessorProjector;
 import org.apache.kylin.storage.hbase.common.coprocessor.CoprocessorRowType;
@@ -207,7 +206,7 @@ public class AggregateRegionObserverTest {
     }
 
     private TblColRef newCol(int i, String name, TableDesc t) {
-        return ColumnDesc.mockup(t, i, name, null).getRef();
+        return TblColRef.mockup(t, i, name, null);
     }
 
     public static class MockupRegionScanner implements RegionScanner {


Mime
View raw message