You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by zh...@apache.org on 2017/01/20 10:57:24 UTC

[1/2] kylin git commit: KYLIN 2370 Refine unload and reload table

Repository: kylin
Updated Branches:
  refs/heads/master 85a1eb399 -> 8331d8d0a


KYLIN 2370 Refine unload and reload table

Signed-off-by: zhongjian <ji...@163.com>


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

Branch: refs/heads/master
Commit: a853a7c4b6b7d42cc3ffd066b618f5ea72ca0d9f
Parents: 85a1eb3
Author: chenzhx <34...@qq.com>
Authored: Mon Jan 9 15:09:16 2017 +0800
Committer: zhongjian <ji...@163.com>
Committed: Fri Jan 20 16:21:11 2017 +0800

----------------------------------------------------------------------
 webapp/app/css/AdminLTE.css                     |  27 +++
 webapp/app/js/controllers/sourceMeta.js         | 175 ++++++++-----------
 .../js/directives/kylin_abn_tree_directive.js   |   7 +-
 .../app/partials/tables/source_table_tree.html  |   6 +-
 webapp/app/partials/tables/table_unload.html    |  33 ----
 5 files changed, 111 insertions(+), 137 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/a853a7c4/webapp/app/css/AdminLTE.css
----------------------------------------------------------------------
diff --git a/webapp/app/css/AdminLTE.css b/webapp/app/css/AdminLTE.css
index 857dbf7..c7740d1 100644
--- a/webapp/app/css/AdminLTE.css
+++ b/webapp/app/css/AdminLTE.css
@@ -4800,3 +4800,30 @@ Gradient Background colors
     white-space: normal !important;
   }
 }
+
+.abn-tree .abn-tree-row .tree-table-btn{
+    width: 4%;
+    float: right;
+    border-radius: 5px;
+    margin-right: 5px;
+    padding: 3px 16px 2px 5px;
+    color: #ffffff;
+    position:static;
+}
+.abn-tree .abn-tree-row .tree-table-btn .tooltip{
+    overflow:visible;
+}
+.abn-tree .abn-tree-row .btn-info:hover{
+   background-color:#269abc;
+}
+.abn-tree > .abn-tree-row.active > .btn-info{
+    background-color:#269abc;
+    border-left-color:#269abc;
+}
+.abn-tree .abn-tree-row .btn-success:hover{
+    background-color:#008d4c;
+}
+.abn-tree > .abn-tree-row.active > .btn-success{
+    background-color:#008d4c;
+    border-left-color:#008d4c;
+}

http://git-wip-us.apache.org/repos/asf/kylin/blob/a853a7c4/webapp/app/js/controllers/sourceMeta.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/sourceMeta.js b/webapp/app/js/controllers/sourceMeta.js
index a53a35f..5421673 100755
--- a/webapp/app/js/controllers/sourceMeta.js
+++ b/webapp/app/js/controllers/sourceMeta.js
@@ -132,31 +132,83 @@ KylinApp
       });
     };
 
-    $scope.openUnLoadModal = function () {
-      if(!$scope.projectModel.selectedProject){
-        SweetAlert.swal('Oops...', "Please select a project.", 'info');
+    $scope.reloadTable = function (tableName,projectName){
+      loadingRequest.show();
+      TableService.loadHiveTable({tableName: tableName, action: projectName}, {calculate: $scope.isCalculate}, function (result) {
+        var loadTableInfo = "";
+        angular.forEach(result['result.loaded'], function (table) {
+          loadTableInfo += "\n" + table;
+        })
+        var unloadedTableInfo = "";
+        angular.forEach(result['result.unloaded'], function (table) {
+          unloadedTableInfo += "\n" + table;
+        })
+        if (result['result.unloaded'].length != 0 && result['result.loaded'].length == 0) {
+          SweetAlert.swal('Failed!', 'Failed to load following table(s): ' + unloadedTableInfo, 'error');
+        }
+        if (result['result.loaded'].length != 0 && result['result.unloaded'].length == 0) {
+          SweetAlert.swal('Success!', 'The following table(s) have been successfully loaded: ' + loadTableInfo, 'success');
+        }
+        if (result['result.loaded'].length != 0 && result['result.unloaded'].length != 0) {
+          SweetAlert.swal('Partial loaded!', 'The following table(s) have been successfully loaded: ' + loadTableInfo + "\n\n Failed to load following table(s):" + unloadedTableInfo, 'warning');
+        }
+        loadingRequest.hide();
+        $scope.aceSrcTbLoaded(true);
+      }, function (e) {
+        if (e.data && e.data.exception) {
+          var message = e.data.exception;
+          var msg = !!(message) ? message : 'Failed to take action.';
+          SweetAlert.swal('Oops...', msg, 'error');
+        } else {
+          SweetAlert.swal('Oops...', "Failed to take action.", 'error');
+        }
+        loadingRequest.hide();
+      })
+    }
+
+
+
+    $scope.removeList = function (tableName,projectName) {
+      if (tableName.trim() === "") {
+        SweetAlert.swal('', 'Please input table(s) you want to unload.', 'info');
         return;
       }
-      $modal.open({
-        templateUrl: 'removeHiveTable.html',
-        controller: ModalInstanceCtrl,
-        backdrop : 'static',
-        resolve: {
-          tableNames: function () {
-            return $scope.tableNames;
-          },
-          projectName: function () {
-            return $scope.projectModel.selectedProject;
-          },
-          isCalculate: function () {
-            return $scope.isCalculate;
-          },
-          scope: function () {
-            return $scope;
-          }
+      if (!projectName) {
+        SweetAlert.swal('', 'Please choose your project first!.', 'info');
+        return;
+      }
+      loadingRequest.show();
+      TableService.unLoadHiveTable({tableName: tableName, action: projectName}, {}, function (result) {
+        var removedTableInfo = "";
+        angular.forEach(result['result.unload.success'], function (table) {
+          removedTableInfo += "\n" + table;
+        })
+        var unRemovedTableInfo = "";
+        angular.forEach(result['result.unload.fail'], function (table) {
+          unRemovedTableInfo += "\n" + table;
+        })
+        if (result['result.unload.fail'].length != 0 && result['result.unload.success'].length == 0) {
+          SweetAlert.swal('Failed!', 'Failed to unload following table(s): ' + unRemovedTableInfo, 'error');
+        }
+        if (result['result.unload.success'].length != 0 && result['result.unload.fail'].length == 0) {
+          SweetAlert.swal('Success!', 'The following table(s) have been successfully unloaded: ' + removedTableInfo, 'success');
+        }
+        if (result['result.unload.success'].length != 0 && result['result.unload.fail'].length != 0) {
+          SweetAlert.swal('Partial unloaded!', 'The following table(s) have been successfully unloaded: ' + removedTableInfo + "\n\n Failed to unload following table(s):" + unRemovedTableInfo, 'warning');
+        }
+        loadingRequest.hide();
+        $scope.aceSrcTbLoaded(true);
+      }, function (e) {
+        if (e.data && e.data.exception) {
+          var message = e.data.exception;
+          var msg = !!(message) ? message : 'Failed to take action.';
+          SweetAlert.swal('Oops...', msg, 'error');
+        } else {
+          SweetAlert.swal('Oops...', "Failed to take action.", 'error');
         }
-      });
-    };
+        loadingRequest.hide();
+      })
+    }
 
     var ModalInstanceCtrl = function ($scope, $location, $modalInstance, tableNames, MessageService, projectName, isCalculate, scope, kylinConfig) {
       $scope.tableNames = "";
@@ -340,88 +392,11 @@ KylinApp
         }
 
         $scope.cancel();
-        loadingRequest.show();
-        TableService.loadHiveTable({tableName: $scope.tableNames, action: projectName}, {calculate: $scope.isCalculate}, function (result) {
-          var loadTableInfo = "";
-          angular.forEach(result['result.loaded'], function (table) {
-            loadTableInfo += "\n" + table;
-          })
-          var unloadedTableInfo = "";
-          angular.forEach(result['result.unloaded'], function (table) {
-            unloadedTableInfo += "\n" + table;
-          })
-
-          if (result['result.unloaded'].length != 0 && result['result.loaded'].length == 0) {
-            SweetAlert.swal('Failed!', 'Failed to load following table(s): ' + unloadedTableInfo, 'error');
-          }
-          if (result['result.loaded'].length != 0 && result['result.unloaded'].length == 0) {
-            SweetAlert.swal('Success!', 'The following table(s) have been successfully loaded: ' + loadTableInfo, 'success');
-          }
-          if (result['result.loaded'].length != 0 && result['result.unloaded'].length != 0) {
-            SweetAlert.swal('Partial loaded!', 'The following table(s) have been successfully loaded: ' + loadTableInfo + "\n\n Failed to load following table(s):" + unloadedTableInfo, 'warning');
-          }
-          loadingRequest.hide();
-          scope.aceSrcTbLoaded(true);
-
-        }, function (e) {
-          if (e.data && e.data.exception) {
-            var message = e.data.exception;
-            var msg = !!(message) ? message : 'Failed to take action.';
-            SweetAlert.swal('Oops...', msg, 'error');
-          } else {
-            SweetAlert.swal('Oops...', "Failed to take action.", 'error');
-          }
-          loadingRequest.hide();
-        })
+        scope.reloadTable ($scope.tableNames,projectName);
       }
 
 
-    $scope.remove = function () {
-        if ($scope.tableNames.trim() === "") {
-          SweetAlert.swal('', 'Please input table(s) you want to unload.', 'info');
-          return;
-        }
-
-        if (!$scope.projectName) {
-          SweetAlert.swal('', 'Please choose your project first!.', 'info');
-          return;
-        }
-
-        $scope.cancel();
-        loadingRequest.show();
-        TableService.unLoadHiveTable({tableName: $scope.tableNames, action: projectName}, {}, function (result) {
-          var removedTableInfo = "";
-          angular.forEach(result['result.unload.success'], function (table) {
-            removedTableInfo += "\n" + table;
-          })
-          var unRemovedTableInfo = "";
-          angular.forEach(result['result.unload.fail'], function (table) {
-            unRemovedTableInfo += "\n" + table;
-          })
-
-          if (result['result.unload.fail'].length != 0 && result['result.unload.success'].length == 0) {
-            SweetAlert.swal('Failed!', 'Failed to unload following table(s): ' + unRemovedTableInfo, 'error');
-          }
-          if (result['result.unload.success'].length != 0 && result['result.unload.fail'].length == 0) {
-            SweetAlert.swal('Success!', 'The following table(s) have been successfully unloaded: ' + removedTableInfo, 'success');
-          }
-          if (result['result.unload.success'].length != 0 && result['result.unload.fail'].length != 0) {
-            SweetAlert.swal('Partial unloaded!', 'The following table(s) have been successfully unloaded: ' + removedTableInfo + "\n\n Failed to unload following table(s):" + unRemovedTableInfo, 'warning');
-          }
-          loadingRequest.hide();
-          scope.aceSrcTbLoaded(true);
 
-        }, function (e) {
-          if (e.data && e.data.exception) {
-            var message = e.data.exception;
-            var msg = !!(message) ? message : 'Failed to take action.';
-            SweetAlert.swal('Oops...', msg, 'error');
-          } else {
-            SweetAlert.swal('Oops...', "Failed to take action.", 'error');
-          }
-          loadingRequest.hide();
-        })
-      }
     };
 
     $scope.editStreamingConfig = function(tableName){

http://git-wip-us.apache.org/repos/asf/kylin/blob/a853a7c4/webapp/app/js/directives/kylin_abn_tree_directive.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/directives/kylin_abn_tree_directive.js b/webapp/app/js/directives/kylin_abn_tree_directive.js
index a3023ab..7545666 100644
--- a/webapp/app/js/directives/kylin_abn_tree_directive.js
+++ b/webapp/app/js/directives/kylin_abn_tree_directive.js
@@ -31,9 +31,13 @@
     '$timeout', function($timeout) {
       return {
         restrict: 'E',
-        template: "<ul class=\"nav nav-list nav-pills nav-stacked abn-tree\">\n  <li ng-repeat=\"row in tree_rows | filter:{visible:true} track by row.branch.uid\" ng-animate=\"'abn-tree-animate'\" ng-class=\"'level-' + {{ row.level }} + (row.branch.selected ? ' active':'') + ' ' +row.classes.join(' ')\" class=\"abn-tree-row\"><a ng-click=\"user_clicks_branch(row.branch)\" ng-dblclick=\"user_dbClicks_branch(row.branch)\"><i ng-class=\"row.tree_icon\" class=\"indented tree-icon\"> </i><span class=\"indented tree-label\">{{ row.label }} </span></a></li>\n</ul>",
+        template: "<ul class=\"nav nav-list nav-pills nav-stacked abn-tree\">\n  <li data=\"{{row.branch.fullName}}\"  ng-repeat=\"row in tree_rows | filter:{visible:true} track by row.branch.uid\" ng-animate=\"'abn-tree-animate'\" ng-class=\"'level-' + {{ row.level }} + (row.branch.selected ? ' active':'') + ' ' +row.classes.join(' ')\" class=\"abn-tree-row\" ><a ng-click=\"user_clicks_branch(row.branch)\" ng-dblclick=\"user_dbClicks_branch(row.branch)\" style=\"width:80%;float:left;\"><i ng-class=\"row.tree_icon\" class=\"indented tree-icon\" > </i><span class=\"indented tree-label\">{{ row.label }} </span></a>  <a class=\"btn btn-xs btn-info tree-table-btn\"   ng-if=\"row.branch.data.exd&&row.level==2&&userService.hasRole('ROLE_ADMIN')&&row.branch.data.source_type==0 \" tooltip=\"UnLoad Hive Table\" tooltip-placement=\"left\" ng-click=\"unloadTable({tableName:row.branch.label,projectName:projectName})\" ><i class=\"fa fa-remove\"></i></a> <a class=\"btn btn-xs btn-success tree-ta
 ble-btn\" tooltip-placement=\"left\" tooltip=\"ReLoad Hive Table\" ng-if=\"row.level==2&&userService.hasRole('ROLE_ADMIN')&&row.branch.data.source_type==0\"  ng-click=\"reloadTable({tableName:row.branch.label,projectName:projectName})\"><i class=\"fa fa-download\"></i></a> </li>\n</ul>",
         replace: true,
         scope: {
+          userService:'=',
+          reloadTable:'&',
+          unloadTable:'&',
+          projectName:'@',
           treeData: '=',
           onSelect: '&',
           onDblclick:'&',
@@ -186,7 +190,6 @@
                 return b.uid = "" + Math.random();
               }
             });
-            console.log('UIDs are set.');
             for_each_branch(function(b) {
               var child, _i, _len, _ref, _results;
               if (angular.isArray(b.children)) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/a853a7c4/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 3008d8c..eb1ad79 100755
--- a/webapp/app/partials/tables/source_table_tree.html
+++ b/webapp/app/partials/tables/source_table_tree.html
@@ -27,7 +27,6 @@
             <div class="pull-right">
               <a class="btn btn-xs btn-primary" tooltip="Load Hive Table"  ng-if="userService.hasRole('ROLE_ADMIN')"  ng-click="openModal()"><i class="fa fa-download"></i></a>
               <a class="btn btn-xs btn-info" tooltip="Load Hive Table From Tree"  ng-if="userService.hasRole('ROLE_ADMIN')"  ng-click="openTreeModal()"><i class="fa fa-download"></i></a>
-              <a class="btn btn-xs btn-info" tooltip="Unload Hive Table"  ng-if="userService.hasRole('ROLE_ADMIN')"  ng-click="openUnLoadModal()"><i class="fa fa-remove"></i></a>
               <a class="btn btn-xs btn-primary" tooltip="Add Streaming Table"  ng-if="userService.hasRole('ROLE_ADMIN')"  ng-click="openStreamingSourceModal()"><i class="fa fa-area-chart"></i></a>
             </div>
         </div>
@@ -37,6 +36,10 @@
     <!--tree-->
     <div style="width:100%; height:{{window}}px; overflow:auto;">
         <abn-tree
+                user-service      = "userService"
+                reload-table      = "reloadTable(tableName,projectName)"
+                unload-table      = "removeList(tableName,projectName)"
+                project-name      = "{{projectModel.selectedProject}}"
                 tree-data         = "tableModel.selectedSrcDb"
                 tree-control      = "my_tree"
                 icon-leaf         = "fa fa-columns"
@@ -75,4 +78,3 @@
 </script>
 
 <div ng-include="'partials/tables/table_load.html'"></div>
-<div ng-include="'partials/tables/table_unload.html'"></div>

http://git-wip-us.apache.org/repos/asf/kylin/blob/a853a7c4/webapp/app/partials/tables/table_unload.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/table_unload.html b/webapp/app/partials/tables/table_unload.html
deleted file mode 100644
index 258551e..0000000
--- a/webapp/app/partials/tables/table_unload.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
--->
-
-  <script type="text/ng-template" id="removeHiveTable.html">
-    <div class="modal-header">
-      <h4>Unload Hive Table Metadata</h4>
-    </div>
-    <div class="modal-body">
-      <span><strong>Project: </strong>{{ $parent.projectName!=null?$parent.projectName:'NULL'}}</span>
-      <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>
-    </div>
-    <div class="modal-footer">
-      <button class="btn btn-primary" ng-click="remove()">Unload</button>
-      <button class="btn btn-primary" ng-click="cancel()">Cancel</button>
-    </div>
-  </script>


[2/2] kylin git commit: KYLIN-2308 Allow user to set more columnFamily in web

Posted by zh...@apache.org.
KYLIN-2308 Allow user to set more columnFamily in web

Signed-off-by: zhongjian <ji...@163.com>


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

Branch: refs/heads/master
Commit: 8331d8d0ad37d24bdbfa90d1032bcdd063aa0a59
Parents: a853a7c
Author: kangkaisen <ka...@live.com>
Authored: Sat Jan 7 15:34:57 2017 +0800
Committer: zhongjian <ji...@163.com>
Committed: Fri Jan 20 17:25:28 2017 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeAdvanceSetting.js | 75 +++++++++++++++-
 webapp/app/js/controllers/cubeEdit.js           | 51 -----------
 webapp/app/js/controllers/cubeSchema.js         | 13 +++
 webapp/app/js/filters/filter.js                 | 22 +++--
 .../cubeDesigner/advanced_settings.html         | 92 +++++++++++++++++++-
 5 files changed, 194 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/8331d8d0/webapp/app/js/controllers/cubeAdvanceSetting.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeAdvanceSetting.js b/webapp/app/js/controllers/cubeAdvanceSetting.js
index 760133a..39d36b0 100644
--- a/webapp/app/js/controllers/cubeAdvanceSetting.js
+++ b/webapp/app/js/controllers/cubeAdvanceSetting.js
@@ -278,11 +278,84 @@ KylinApp.controller('CubeAdvanceSettingCtrl', function ($scope, $modal,cubeConfi
     $scope.isReuse=!$scope.isReuse;
   }
 
-  $scope.removeDictionaries =  function(arr,element){
+  $scope.removeElement =  function(arr,element){
     var index = arr.indexOf(element);
     if (index > -1) {
       arr.splice(index, 1);
     }
   };
 
+  $scope.newColFamily = function (index) {
+    return {
+        "name": "F" + index,
+        "columns": [
+          {
+            "qualifier": "M",
+            "measure_refs": []
+          }
+        ]
+      };
+  };
+
+  $scope.initColumnFamily = function () {
+    $scope.cubeMetaFrame.hbase_mapping.column_family = [];
+    var normalMeasures = [], distinctCountMeasures = [];
+    angular.forEach($scope.cubeMetaFrame.measures, function (measure, index) {
+      if (measure.function.expression === 'COUNT_DISTINCT') {
+        distinctCountMeasures.push(measure);
+      } else {
+        normalMeasures.push(measure);
+      }
+    });
+    if (normalMeasures.length > 0) {
+      var nmcf = $scope.newColFamily(1);
+      angular.forEach(normalMeasures, function (normalM, index) {
+        nmcf.columns[0].measure_refs.push(normalM.name);
+      });
+      $scope.cubeMetaFrame.hbase_mapping.column_family.push(nmcf);
+    }
+
+    if (distinctCountMeasures.length > 0) {
+      var dccf = $scope.newColFamily(2);
+      angular.forEach(distinctCountMeasures, function (dcm, index) {
+        dccf.columns[0].measure_refs.push(dcm.name);
+      });
+      $scope.cubeMetaFrame.hbase_mapping.column_family.push(dccf);
+    }
+  };
+
+  $scope.getAllMeasureNames = function () {
+    var measures = [];
+    angular.forEach($scope.cubeMetaFrame.measures, function (measure, index) {
+      measures.push(measure.name);
+    });
+    return measures;
+  };
+
+  $scope.getAssignedMeasureNames = function () {
+    var assignedMeasures = [];
+    angular.forEach($scope.cubeMetaFrame.hbase_mapping.column_family, function (colFamily, index) {
+      angular.forEach(colFamily.columns[0].measure_refs, function (measure, index) {
+        assignedMeasures.push(measure);
+      });
+    });
+    return assignedMeasures;
+  };
+
+  if ($scope.getAllMeasureNames().length != $scope.getAssignedMeasureNames().length) {
+    $scope.initColumnFamily();
+  }
+
+
+  $scope.addColumnFamily = function () {
+    var colFamily = $scope.newColFamily($scope.cubeMetaFrame.hbase_mapping.column_family.length + 1);
+    $scope.cubeMetaFrame.hbase_mapping.column_family.push(colFamily);
+  };
+
+  $scope.refreshColumnFamily = function (column_familys, index, colFamily) {
+    if (column_familys) {
+      column_familys[index] = colFamily;
+    }
+  };
+
 });

http://git-wip-us.apache.org/repos/asf/kylin/blob/8331d8d0/webapp/app/js/controllers/cubeEdit.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js
index edbb421..da19b22 100755
--- a/webapp/app/js/controllers/cubeEdit.js
+++ b/webapp/app/js/controllers/cubeEdit.js
@@ -284,25 +284,6 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio
     return type;
   };
 
-  var ColFamily = function () {
-    var index = 1;
-    return function () {
-      var newColFamily =
-      {
-        "name": "f" + index,
-        "columns": [
-          {
-            "qualifier": "m",
-            "measure_refs": []
-          }
-        ]
-      };
-      index += 1;
-
-      return newColFamily;
-    }
-  };
-
 
   // ~ Define data
   $scope.state = {
@@ -380,8 +361,6 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio
 
 
   $scope.prepareCube = function () {
-    //generate column family
-    generateColumnFamily();
     //generate rowkey
     reGenerateRowKey();
 
@@ -793,36 +772,6 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio
     return groups;
   }
 
-
-  // ~ private methods
-  function generateColumnFamily() {
-    $scope.cubeMetaFrame.hbase_mapping.column_family = [];
-    var colFamily = ColFamily();
-    var normalMeasures = [], distinctCountMeasures = [];
-    angular.forEach($scope.cubeMetaFrame.measures, function (measure, index) {
-      if (measure.function.expression === 'COUNT_DISTINCT') {
-        distinctCountMeasures.push(measure);
-      } else {
-        normalMeasures.push(measure);
-      }
-    });
-    if (normalMeasures.length > 0) {
-      var nmcf = colFamily();
-      angular.forEach(normalMeasures, function (normalM, index) {
-        nmcf.columns[0].measure_refs.push(normalM.name);
-      });
-      $scope.cubeMetaFrame.hbase_mapping.column_family.push(nmcf);
-    }
-
-    if (distinctCountMeasures.length > 0) {
-      var dccf = colFamily();
-      angular.forEach(distinctCountMeasures, function (dcm, index) {
-        dccf.columns[0].measure_refs.push(dcm.name);
-      });
-      $scope.cubeMetaFrame.hbase_mapping.column_family.push(dccf);
-    }
-  }
-
   $scope.$watch('projectModel.selectedProject', function (newValue, oldValue) {
     if(!$scope.projectModel.getSelectedProject()) {
       return;

http://git-wip-us.apache.org/repos/asf/kylin/blob/8331d8d0/webapp/app/js/controllers/cubeSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
index af8ee7c..17371f2 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -275,6 +275,19 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
           errors.push("At most one 'shard by' column is allowed.");
         }
 
+        var cfMeasures = [];
+        angular.forEach($scope.cubeMetaFrame.hbase_mapping.column_family,function(cf){
+          angular.forEach(cf.columns[0].measure_refs, function (measure, index) {
+            cfMeasures.push(measure);
+          });
+        });
+
+        var uniqCfMeasures = _.uniq(cfMeasures);
+        if(uniqCfMeasures.length != $scope.cubeMetaFrame.measures.length) {
+          errors.push("All measures need to be assigned to column family");
+        }
+
+
         var errorInfo = "";
         angular.forEach(errors,function(item){
             errorInfo+="\n"+item;

http://git-wip-us.apache.org/repos/asf/kylin/blob/8331d8d0/webapp/app/js/filters/filter.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/filters/filter.js b/webapp/app/js/filters/filter.js
index aff4e3a..d097075 100755
--- a/webapp/app/js/filters/filter.js
+++ b/webapp/app/js/filters/filter.js
@@ -193,16 +193,26 @@ KylinApp
   }).filter('inDimNotInMea', function ($filter) {
     return function (inputArr, table, arr) {
       var out=[];
-      angular.forEach(arr,function(item){
-        if(item.table==table){
-          angular.forEach(inputArr,function(inputItem){
-            if(item.columns.indexOf(inputItem.name)==-1){
+      angular.forEach(arr,function(item) {
+        if (item.table == table) {
+          angular.forEach(inputArr, function (inputItem) {
+            if (item.columns.indexOf(inputItem.name) == -1) {
               out.push(inputItem);
             }
           });
         }
       });
+    }
+  }).filter('assignedMeasureNames', function ($filter) {
+    //return the measures that haven't assign to column family
+    return function (inputArr, assignedArr) {
+      var out = [];
+      angular.forEach(inputArr, function (inputItem) {
+        if (assignedArr.indexOf(inputItem) == -1) {
+          out.push(inputItem);
+        }
+      });
       return out;
     }
-  })
-  ;
+  });
+

http://git-wip-us.apache.org/repos/asf/kylin/blob/8331d8d0/webapp/app/partials/cubeDesigner/advanced_settings.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/advanced_settings.html b/webapp/app/partials/cubeDesigner/advanced_settings.html
index f9e422c..bf95256 100755
--- a/webapp/app/partials/cubeDesigner/advanced_settings.html
+++ b/webapp/app/partials/cubeDesigner/advanced_settings.html
@@ -302,7 +302,7 @@
                         <i class="fa fa-pencil"></i>
                       </button>
                       <!--Remove Button -->
-                      <button class="btn btn-xs  btn-danger" ng-click="removeDictionaries(cubeMetaFrame.dictionaries, dictionaries)" ng-disabled="instance.status=='READY'">
+                      <button class="btn btn-xs  btn-danger" ng-click="removeElement(cubeMetaFrame.dictionaries, dictionaries)" ng-disabled="instance.status=='READY'">
                         <i class="fa fa-trash-o"></i>
                       </button>
                     </td>
@@ -388,6 +388,89 @@
              <button class="btn btn-link" ng-click="clearNewDictionaries()">Cancel</button>
            </div>
          </div>
+
+         <!--Edit ColumnFamily-->
+         <div class="form-group large-popover" style="overflow:auto">
+           <h3 style="margin-left:42px">Advanced ColumnFamily  <i kylinpopover placement="right" title="Advanced ColumnFamily" template="AdvancedColumnFamilyTip.html" class="fa fa-info-circle"></i></h3>
+           <div style="margin-left:42px">
+             <div class="box-body">
+               <!-- VIEW MODE -->
+               <div class="row"  ng-if="state.mode=='view'&& cubeMetaFrame.hbase_mapping.column_family.length > 0">
+                 <table class="table table-striped table-hover">
+                   <thead>
+                   <tr>
+                     <th class="col-xs-1">CF</th>
+                     <th class="col-xs-11">Measures</th>
+                   </tr>
+                   </thead>
+                   <tbody class="cube-dimension">
+                   <tr ng-repeat="colFamily in cubeMetaFrame.hbase_mapping.column_family | filter:dimState.filter track by $index">
+                     <!--ID -->
+                     <td class="col-xs-1">
+                       <b>{{colFamily.name}}</b>
+                     </td>
+                     <!--Name -->
+                     <td class="col-xs-11">
+                       <span>{{colFamily.columns[0].measure_refs}}</span>
+                     </td>
+                   </tr>
+                   </tbody>
+                 </table>
+               </div>
+
+               <!-- EDIT MODE -->
+               <div  ng-if="state.mode=='edit'" class="form-group " style="width: 100%">
+                 <table ng-if="cubeMetaFrame.hbase_mapping.column_family.length > 0"
+                        class="table table-hover">
+
+                   <tr class="row">
+                     <th class="col-xs-1">CF</th>
+                     <th class="col-xs-10">Measures</th>
+                     <th class="col-xs-1">Actions</th>
+                   </tr>
+
+                   <tr ng-repeat="colFamily in cubeMetaFrame.hbase_mapping.column_family" ng-init="rowIndex = $index" class="row">
+                     <td class="col-xs-1">
+                       <b>{{colFamily.name}}</b>
+                     </td>
+
+                     <td class="col-xs-10">
+                       <ui-select
+                         ng-if="state.mode=='edit'"
+                         style="width: 100%"
+                         autofocus="true"
+                         close-on-select="false"
+                         on-select="refreshColumnFamily(cubeMetaFrame.hbase_mapping.column_family, rowIndex, colFamily)"
+                         on-remove="refreshColumnFamily(cubeMetaFrame.hbase_mapping.column_family, rowIndex, colFamily)"
+                         ng-model="colFamily.columns[0].measure_refs"
+                         multiple>
+                         <ui-select-match placeholder="Select Measure...">{{$item}}</ui-select-match>
+                         <ui-select-choices repeat="measure in getAllMeasureNames() | filter:$select.search |assignedMeasureNames:getAssignedMeasureNames()">
+                           {{measure}}
+                         </ui-select-choices>
+                       </ui-select>
+                     </td>
+
+                     <td class="col-xs-1">
+                       <!--Remove Button -->
+                       <button class="btn btn-xs btn-info" ng-click="removeElement(cubeMetaFrame.hbase_mapping.column_family, colFamily)">
+                         <i class="fa fa-minus"></i>
+                       </button>
+                     </td>
+
+                   </tr>
+                 </table>
+               </div>
+
+               <div class="form-group" >
+                 <button class="btn btn-sm btn-info" ng-click="addColumnFamily()" ng-show="state.mode=='edit'">
+                   <i class="fa fa-plus"></i> ColumnFamily
+                 </button>
+               </div>
+
+             </div>
+           </div>
+         </div>
        </ng-form>
      </div>
    </ng-form>
@@ -419,3 +502,10 @@
     <h4>Special settings for dictionaries. Leave blank by default.</h4>
   </div>
 </script>
+
+<script type="text/ng-template" id="AdvancedColumnFamilyTip.html">
+  <div>
+    <h4>If there are more than one ultrahigh cardinality precise count distinct measures,
+        you could assign these measures to more column family.</h4>
+  </div>
+</script>