kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lid...@apache.org
Subject [45/50] [abbrv] kylin git commit: minor, fix NPE and check table using by model code in MetadataManager
Date Fri, 30 Dec 2016 08:11:10 GMT
minor, fix NPE and check table using by model code in MetadataManager


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

Branch: refs/heads/master-hbase1.x
Commit: 32d724440657fd97462d4d10f9a5d91ba0d5a6da
Parents: a9ee6d3
Author: Billy Liu <billyliu@apache.org>
Authored: Fri Dec 30 11:06:14 2016 +0800
Committer: Billy Liu <billyliu@apache.org>
Committed: Fri Dec 30 11:06:30 2016 +0800

----------------------------------------------------------------------
 .../apache/kylin/metadata/MetadataManager.java  | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/32d72444/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java b/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java
index d0e4b42..7290d4c 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java
@@ -39,6 +39,7 @@ import org.apache.kylin.metadata.model.DataModelDesc;
 import org.apache.kylin.metadata.model.ExternalFilterDesc;
 import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TableExtDesc;
+import org.apache.kylin.metadata.model.TableRef;
 import org.apache.kylin.metadata.project.ProjectInstance;
 import org.apache.kylin.metadata.project.ProjectManager;
 import org.slf4j.Logger;
@@ -395,6 +396,7 @@ public class MetadataManager {
         // remove old json
         if (name == null) {
             getStore().deleteResource(path);
+            return null;
         }
 
         srcTableExdMap.putLocal(name, t);
@@ -495,19 +497,16 @@ public class MetadataManager {
     }
 
     public boolean isTableInModel(String tableName, String projectName) throws IOException
{
-        for (DataModelDesc modelDesc : getModels(projectName)) {
-            if (modelDesc.getAllTables().contains(tableName.toUpperCase())) {
-                return true;
-            }
-        }
-        return false;
+        return getModelsUsingTable(tableName, projectName).size() > 0;
     }
 
     public List<String> getModelsUsingTable(String tableName, String projectName) throws
IOException {
         List<String> models = new ArrayList<>();
         for (DataModelDesc modelDesc : getModels(projectName)) {
-            if (modelDesc.getAllTables().contains(tableName.toUpperCase())) {
-                models.add(modelDesc.getName());
+            for(TableRef tableRef : modelDesc.getAllTables()){
+                if(tableRef.getTableName().equalsIgnoreCase(tableName)){
+                    models.add(modelDesc.getName());
+                }
             }
         }
         return models;
@@ -515,8 +514,10 @@ public class MetadataManager {
 
     public boolean isTableInAnyModel(String tableName) {
         for (DataModelDesc modelDesc : getModels()) {
-            if (modelDesc.getAllTables().contains(tableName.toUpperCase())) {
-                return true;
+            for(TableRef tableRef : modelDesc.getAllTables()){
+                if(tableRef.getTableName().equalsIgnoreCase(tableName)){
+                    return true;
+                }
             }
         }
         return false;


Mime
View raw message