kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaofeng...@apache.org
Subject kylin git commit: KYLIN-1695 Skip cardinality calculation job when loading hive table in web
Date Tue, 24 May 2016 09:58:54 GMT
Repository: kylin
Updated Branches:
  refs/heads/master a5bf99a25 -> 9fb1451a5


KYLIN-1695 Skip cardinality calculation job when loading hive table in web

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/9fb1451a
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/9fb1451a
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/9fb1451a

Branch: refs/heads/master
Commit: 9fb1451a5c1f3ec0dcc8a0070bb38022c30c1a1c
Parents: a5bf99a
Author: kangkaisen <kangkaisen@live.com>
Authored: Sat May 21 15:16:50 2016 +0800
Committer: shaofengshi <shaofengshi@apache.org>
Committed: Tue May 24 17:58:45 2016 +0800

----------------------------------------------------------------------
 .../kylin/rest/controller/TableController.java  |  7 +++++--
 .../kylin/rest/request/HiveTableRequest.java    | 22 ++++++++++++++++++++
 webapp/app/js/controllers/sourceMeta.js         | 17 ++++++++++++---
 .../app/partials/tables/source_table_tree.html  |  1 +
 webapp/app/partials/tables/table_load.html      |  1 +
 5 files changed, 43 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/9fb1451a/server/src/main/java/org/apache/kylin/rest/controller/TableController.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/kylin/rest/controller/TableController.java b/server/src/main/java/org/apache/kylin/rest/controller/TableController.java
index b0da2db..a90ab41 100644
--- a/server/src/main/java/org/apache/kylin/rest/controller/TableController.java
+++ b/server/src/main/java/org/apache/kylin/rest/controller/TableController.java
@@ -34,6 +34,7 @@ import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.rest.exception.InternalErrorException;
 import org.apache.kylin.rest.exception.NotFoundException;
 import org.apache.kylin.rest.request.CardinalityRequest;
+import org.apache.kylin.rest.request.HiveTableRequest;
 import org.apache.kylin.rest.request.StreamingRequest;
 import org.apache.kylin.rest.response.TableDescResponse;
 import org.apache.kylin.rest.service.*;
@@ -131,10 +132,12 @@ public class TableController extends BasicController {
 
     @RequestMapping(value = "/{tables}/{project}", method = { RequestMethod.POST })
     @ResponseBody
-    public Map<String, String[]> loadHiveTable(@PathVariable String tables, @PathVariable
String project) throws IOException {
+    public Map<String, String[]> loadHiveTable(@PathVariable String tables, @PathVariable
String project, @RequestBody HiveTableRequest request) throws IOException {
         String submitter = SecurityContextHolder.getContext().getAuthentication().getName();
         String[] loaded = cubeMgmtService.reloadHiveTable(tables);
-        cubeMgmtService.calculateCardinalityIfNotPresent(loaded, submitter);
+        if (request.isCalculate()) {
+            cubeMgmtService.calculateCardinalityIfNotPresent(loaded, submitter);
+        }
         cubeMgmtService.syncTableToProject(loaded, project);
         Map<String, String[]> result = new HashMap<String, String[]>();
         result.put("result.loaded", loaded);

http://git-wip-us.apache.org/repos/asf/kylin/blob/9fb1451a/server/src/main/java/org/apache/kylin/rest/request/HiveTableRequest.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/kylin/rest/request/HiveTableRequest.java b/server/src/main/java/org/apache/kylin/rest/request/HiveTableRequest.java
new file mode 100644
index 0000000..c2beb5f
--- /dev/null
+++ b/server/src/main/java/org/apache/kylin/rest/request/HiveTableRequest.java
@@ -0,0 +1,22 @@
+package org.apache.kylin.rest.request;
+
+/**
+ * Created by kangkaisen on 16/5/21.
+ */
+public class HiveTableRequest {
+
+    public HiveTableRequest(){
+
+    }
+
+    private boolean calculate = true;
+
+    public boolean isCalculate() {
+        return calculate;
+    }
+    public void setCalculate(boolean calculate) {
+        this.calculate = calculate;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/kylin/blob/9fb1451a/webapp/app/js/controllers/sourceMeta.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/sourceMeta.js b/webapp/app/js/controllers/sourceMeta.js
index 606d88a..9de52f4 100755
--- a/webapp/app/js/controllers/sourceMeta.js
+++ b/webapp/app/js/controllers/sourceMeta.js
@@ -26,7 +26,7 @@ KylinApp
     $scope.tableModel.selectedSrcTable = {};
     $scope.window = 0.68 * $window.innerHeight;
     $scope.tableConfig = tableConfig;
-
+    $scope.isCalculate = true;
 
     $scope.state = {
       filterAttr: 'id', filterReverse: false, reverseColumn: 'id',
@@ -97,6 +97,9 @@ KylinApp
           projectName: function () {
             return $scope.projectModel.selectedProject;
           },
+          isCalculate: function () {
+            return $scope.isCalculate;
+          },
           scope: function () {
             return $scope;
           }
@@ -119,6 +122,9 @@ KylinApp
           projectName:function(){
             return  $scope.projectModel.selectedProject;
           },
+          isCalculate: function () {
+            return $scope.isCalculate;
+          },
           scope: function () {
             return $scope;
           }
@@ -142,6 +148,9 @@ KylinApp
           projectName: function () {
             return $scope.projectModel.selectedProject;
           },
+          isCalculate: function () {
+            return $scope.isCalculate;
+          },
           scope: function () {
             return $scope;
           }
@@ -149,9 +158,11 @@ KylinApp
       });
     };
 
-    var ModalInstanceCtrl = function ($scope, $location, $modalInstance, tableNames, MessageService,
projectName, scope,kylinConfig) {
+    var ModalInstanceCtrl = function ($scope, $location, $modalInstance, tableNames, MessageService,
projectName, isCalculate, scope, kylinConfig) {
       $scope.tableNames = "";
       $scope.projectName = projectName;
+      $scope.isCalculate = isCalculate;
+
       $scope.cancel = function () {
         $modalInstance.dismiss('cancel');
       };
@@ -330,7 +341,7 @@ KylinApp
 
         $scope.cancel();
         loadingRequest.show();
-        TableService.loadHiveTable({tableName: $scope.tableNames, action: projectName}, {},
function (result) {
+        TableService.loadHiveTable({tableName: $scope.tableNames, action: projectName}, {calculate:
$scope.isCalculate}, function (result) {
           var loadTableInfo = "";
           angular.forEach(result['result.loaded'], function (table) {
             loadTableInfo += "\n" + table;

http://git-wip-us.apache.org/repos/asf/kylin/blob/9fb1451a/webapp/app/partials/tables/source_table_tree.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/source_table_tree.html b/webapp/app/partials/tables/source_table_tree.html
index 8bbaa96..3008d8c 100755
--- a/webapp/app/partials/tables/source_table_tree.html
+++ b/webapp/app/partials/tables/source_table_tree.html
@@ -64,6 +64,7 @@
       <button class="btn btn-xs btn-primary" ng-if="node.label==''&&node.id==65535"
ng-click="showAllClicked($parentNode)">Show All</button>
       {{node.label}}
     </treecontrol>
+    <label> <input type="checkbox" ng-model="$parent.isCalculate" >Calculate
column cardinality</label>
   </div>
 
   <div class="modal-footer">

http://git-wip-us.apache.org/repos/asf/kylin/blob/9fb1451a/webapp/app/partials/tables/table_load.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/table_load.html b/webapp/app/partials/tables/table_load.html
index 1fd4751..834abda 100644
--- a/webapp/app/partials/tables/table_load.html
+++ b/webapp/app/partials/tables/table_load.html
@@ -25,6 +25,7 @@
       <label for="tables"> Table Names:(Seperate with comma)</label>
             <textarea ng-model="$parent.tableNames" class="form-control" id="tables"
                       placeholder="table1,table2  By default,system will choose 'Default'
as database,you can specify database like this 'database.table'"></textarea>
+      <label> <input type="checkbox" ng-model="$parent.isCalculate" >Calculate
column cardinality</label>
     </div>
     <div class="modal-footer">
       <button class="btn btn-primary" ng-click="add()">Sync</button>


Mime
View raw message