You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2019/09/10 13:02:53 UTC

[kylin] branch master updated: KYLIN-4155 refresh cube info in time

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

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


The following commit(s) were added to refs/heads/master by this push:
     new ce0e336  KYLIN-4155 refresh cube info in time
ce0e336 is described below

commit ce0e336ffe4433feee4b0582bfec5f8afc686caf
Author: luguosheng1314 <55...@qq.com>
AuthorDate: Fri Sep 6 19:37:37 2019 +0800

    KYLIN-4155 refresh cube info in time
---
 .../org/apache/kylin/rest/controller/CubeController.java |  8 ++++----
 webapp/app/js/controllers/cubes.js                       | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java b/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
index 8efa420..734af4b 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
@@ -186,8 +186,7 @@ public class CubeController extends BasicController {
     @ResponseBody
     public CubeInstance getCube(@PathVariable String cubeName) {
         checkCubeExists(cubeName);
-        CubeInstance cube = cubeService.getCubeManager().getCube(cubeName);
-        return cube;
+        return cubeService.getCubeManager().getCube(cubeName);
     }
 
     /**
@@ -426,7 +425,7 @@ public class CubeController extends BasicController {
             String jobID = cubeService.mergeCubeSegment(cubeName);
             if (jobID == null) {
                 throw new BadRequestException(String.format(Locale.ROOT,
-                    "Cube: %s merging is not supported or no segments to merge", cubeName));
+                        "Cube: %s merging is not supported or no segments to merge", cubeName));
             }
             return jobService.getJobInstance(jobID);
         } catch (Exception e) {
@@ -667,7 +666,8 @@ public class CubeController extends BasicController {
             String encodingName = (String) encodingConf[0];
             String[] encodingArgs = (String[]) encodingConf[1];
 
-            if (!DimensionEncodingFactory.isValidEncoding(encodingName, encodingArgs, rowKeyColDesc.getEncodingVersion())) {
+            if (!DimensionEncodingFactory.isValidEncoding(encodingName, encodingArgs,
+                    rowKeyColDesc.getEncodingVersion())) {
                 throw new BadRequestException("Illegal row key column desc: " + rowKeyColDesc);
             }
         }
diff --git a/webapp/app/js/controllers/cubes.js b/webapp/app/js/controllers/cubes.js
index 6a84ed9..5038937 100644
--- a/webapp/app/js/controllers/cubes.js
+++ b/webapp/app/js/controllers/cubes.js
@@ -45,8 +45,20 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, $routeParams, $location,
         cubeName: cube.name
       };
       var defer = $q.defer();
-      CubeService.getCube(queryParam, function(cube){
-        defer.resolve(cube);
+      CubeService.getCube(queryParam, function(newCube){
+        var segmentsLen = newCube.segments && newCube.segments.length || 0
+        newCube.input_records_count = 0;
+        for(var i = segmentsLen - 1;i >= 0;i--){
+          var curSeg = newCube.segments[i]
+          if(curSeg.status === "READY"){
+            newCube.input_records_count += curSeg.input_records
+            if(newCube.last_build_time === undefined || newCube.last_build_time < curSeg.last_build_time) {
+              newCube.last_build_time = curSeg.last_build_time;
+            }
+          }
+        }
+        newCube.project = cube.project;
+        defer.resolve(newCube);
       },function(e){
         defer.resolve([]);
       })