kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lid...@apache.org
Subject [27/50] [abbrv] kylin git commit: KYLIN-1982 CubeMigrationCLI: associate model with project
Date Sat, 03 Sep 2016 12:46:21 GMT
KYLIN-1982 CubeMigrationCLI: associate model with project

Signed-off-by: shaofengshi <shaofengshi@apache.org>


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

Branch: refs/heads/1.5.x-CDH5.7
Commit: c5fdacde4f8f8748259afcb6800b53f9838fda75
Parents: 42f2868
Author: kangkaisen <kangkaisen@live.com>
Authored: Sun Aug 28 20:54:26 2016 +0800
Committer: shaofengshi <shaofengshi@apache.org>
Committed: Tue Aug 30 23:25:51 2016 +0800

----------------------------------------------------------------------
 .../kylin/storage/hbase/util/CubeMigrationCLI.java | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/c5fdacde/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java
b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java
index c4cf579..0ecb6fb 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/CubeMigrationCLI.java
@@ -138,7 +138,7 @@ public class CubeMigrationCLI {
         copyFilesInMetaStore(cube, overwriteIfExists);
         renameFoldersInHdfs(cube);
         changeHtableHost(cube);
-        addCubeIntoProject(cubeName, projectName);
+        addCubeAndModelIntoProject(cube, cubeName, projectName);
         if (Boolean.parseBoolean(copyAcl) == true) {
             copyACL(cube, projectName);
         }
@@ -227,13 +227,12 @@ public class CubeMigrationCLI {
             operations.add(new Opt(OptType.COPY_DICT_OR_SNAPSHOT, new Object[] { item, cube.getName()
}));
         }
     }
-
-    private static void addCubeIntoProject(String cubeName, String projectName) throws IOException
{
+    private static void addCubeAndModelIntoProject(CubeInstance srcCube, String cubeName,
String projectName) throws IOException {
         String projectResPath = ProjectInstance.concatResourcePath(projectName);
         if (!dstStore.exists(projectResPath))
             throw new IllegalStateException("The target project " + projectName + "does not
exist");
 
-        operations.add(new Opt(OptType.ADD_INTO_PROJECT, new Object[] { cubeName, projectName
}));
+        operations.add(new Opt(OptType.ADD_INTO_PROJECT, new Object[] { srcCube, cubeName,
projectName }));
     }
 
     private static void purgeAndDisable(String cubeName) throws IOException {
@@ -419,13 +418,19 @@ public class CubeMigrationCLI {
             break;
         }
         case ADD_INTO_PROJECT: {
-            String cubeName = (String) opt.params[0];
-            String projectName = (String) opt.params[1];
+            CubeInstance srcCube = (CubeInstance) opt.params[0];
+            String cubeName = (String) opt.params[1];
+            String projectName = (String) opt.params[2];
+            String modelName = srcCube.getDescriptor().getModelName();
+
             String projectResPath = ProjectInstance.concatResourcePath(projectName);
             Serializer<ProjectInstance> projectSerializer = new JsonSerializer<ProjectInstance>(ProjectInstance.class);
             ProjectInstance project = dstStore.getResource(projectResPath, ProjectInstance.class,
projectSerializer);
+
+            project.addModel(modelName);
             project.removeRealization(RealizationType.CUBE, cubeName);
             project.addRealizationEntry(RealizationType.CUBE, cubeName);
+
             dstStore.putResource(projectResPath, project, projectSerializer);
             logger.info("Project instance for " + projectName + " is corrected");
             break;


Mime
View raw message