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 2018/05/26 10:53:17 UTC

[kylin] 01/08: KYLIN-3315 fix table init

This is an automated email from the ASF dual-hosted git repository.

liyang pushed a commit to branch sync
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 0b2e794fe79d461f84852a3dc98f4429cfb5c3c1
Author: lidongsjtu <li...@apache.org>
AuthorDate: Sun Apr 22 23:30:25 2018 +0800

    KYLIN-3315 fix table init
---
 .../java/org/apache/kylin/metadata/model/TableDesc.java | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java
index a9e9877..123fedb 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java
@@ -28,6 +28,8 @@ import org.apache.kylin.common.persistence.RootPersistentEntity;
 import org.apache.kylin.common.util.Pair;
 import org.apache.kylin.common.util.StringSplitter;
 import org.apache.kylin.metadata.MetadataConstants;
+import org.apache.kylin.metadata.project.ProjectInstance;
+import org.apache.kylin.metadata.project.ProjectManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,7 +53,7 @@ public class TableDesc extends RootPersistentEntity implements ISourceAware {
     public static String concatRawResourcePath(String nameOnPath) {
         return ResourceStore.TABLE_RESOURCE_ROOT + "/" + nameOnPath + ".json";
     }
-    
+
     public static String makeResourceName(String tableIdentity, String prj) {
         return prj == null ? tableIdentity : tableIdentity + "--" + prj;
     }
@@ -132,7 +134,7 @@ public class TableDesc extends RootPersistentEntity implements ISourceAware {
     public String resourceName() {
         return makeResourceName(getIdentity(), getProject());
     }
-    
+
     public TableDesc appendColumns(ColumnDesc[] computedColumns, boolean makeCopy) {
         if (computedColumns == null || computedColumns.length == 0) {
             return this;
@@ -193,7 +195,7 @@ public class TableDesc extends RootPersistentEntity implements ISourceAware {
         if (isBorrowedFromGlobal()) {
             return concatResourcePath(getIdentity(), null);
         }
-        
+
         return concatResourcePath(getIdentity(), project);
     }
 
@@ -292,8 +294,13 @@ public class TableDesc extends RootPersistentEntity implements ISourceAware {
 
     public void init(KylinConfig config, String project) {
         this.project = project;
-        this.config = config;
-        
+        if (project == null) {
+            this.config = config;
+        } else {
+            ProjectInstance projInstance = ProjectManager.getInstance(config).getProject(project);
+            this.config = projInstance == null ? config : projInstance.getConfig();
+        }
+
         if (name != null)
             name = name.toUpperCase();
 

-- 
To stop receiving notification emails like this one, please contact
liyang@apache.org.