kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [24/50] incubator-kylin git commit: Fix a bug in parsing partition column
Date Sat, 14 Mar 2015 00:01:37 GMT
Fix a bug in parsing partition column

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

Branch: refs/heads/streaming
Commit: 6074fb4e571617919f057053a24e820c57f9de2d
Parents: f020763
Author: Shao Feng, Shi <shaoshi@ebay.com>
Authored: Mon Mar 9 17:33:37 2015 +0800
Committer: Shao Feng, Shi <shaoshi@ebay.com>
Committed: Mon Mar 9 17:33:37 2015 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kylin/cube/model/CubeDesc.java |  4 ----
 .../org/apache/kylin/metadata/model/DataModelDesc.java  |  5 +++++
 .../org/apache/kylin/metadata/model/PartitionDesc.java  | 12 +++++++-----
 3 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/6074fb4e/cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
----------------------------------------------------------------------
diff --git a/cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java b/cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
index 1f7e02a..0c9cf7a 100644
--- a/cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
+++ b/cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
@@ -449,10 +449,6 @@ public class CubeDesc extends RootPersistentEntity {
 
         initMeasureReferenceToColumnFamily();
 
-        if (null != this.model.getPartitionDesc()) {
-            this.model.getPartitionDesc().init(columnMap);
-        }
-
         // check all dimension columns are presented on rowkey
         List<TblColRef> dimCols = listDimensionColumnsExcludingDerived();
         if (rowkey.getRowKeyColumns().length != dimCols.size()) {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/6074fb4e/metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java b/metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
index 6d1bc65..c9271fc 100644
--- a/metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
+++ b/metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
@@ -143,8 +143,13 @@ public class DataModelDesc extends RootPersistentEntity {
 
     public void init(Map<String, TableDesc> tables) {
         initJoinColumns(tables);
+        initPartitionDesc(tables);
     }
 
+    private void initPartitionDesc(Map<String, TableDesc> tables) {
+        if(this.partitionDesc != null)
+            this.partitionDesc.init(tables);
+    }
     private void initJoinColumns(Map<String, TableDesc> tables) {
         // join columns may or may not present in cube;
         // here we don't modify 'allColumns' and 'dimensionColumns';

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/6074fb4e/metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java b/metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java
index 3b3fe94..cf0a8e3 100644
--- a/metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java
+++ b/metadata/src/main/java/org/apache/kylin/metadata/model/PartitionDesc.java
@@ -47,7 +47,7 @@ public class PartitionDesc {
 
     private TblColRef partitionDateColumnRef;
 
-    public void init(Map<String, Map<String, TblColRef>> columnMap) {
+    public void init(Map<String, TableDesc> tables) {
         if (StringUtils.isNotEmpty(partitionDateColumn)) {
             partitionDateColumn = partitionDateColumn.toUpperCase();
 
@@ -55,11 +55,13 @@ public class PartitionDesc {
 
             if (null != columns && columns.length == 3) {
                 String tableName = columns[0].toUpperCase() + "." + columns[1].toUpperCase();
-                Map<String, TblColRef> cols = columnMap.get(tableName);
-                if (cols != null) {
-                    partitionDateColumnRef = cols.get(columns[2].toUpperCase());
+
+                TableDesc table = tables.get(tableName);
+                ColumnDesc col = table.findColumnByName(columns[2]);
+                if (col != null) {
+                    partitionDateColumnRef = new TblColRef(col);
                 } else {
-                    throw new IllegalStateException("The table '" + tableName + "' provided
in 'partition_date_column' doesn't exist.");
+                    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}.");


Mime
View raw message