Repository: kylin Updated Branches: refs/heads/yang-m1 19d497015 -> 42913ff40
KYLIN-1599 add shardBy in rowkey panel Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/f450414f Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/f450414f Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/f450414f Branch: refs/heads/yang-m1 Commit: f450414fccabc739d6a74ddc15b39567abe6756b Parents: 19d4970 Author: Jason <jiat...@163.com> Authored: Thu Apr 21 11:17:39 2016 +0800 Committer: Jason <jiat...@163.com> Committed: Thu May 5 16:53:11 2016 +0800 ---------------------------------------------------------------------- webapp/app/js/controllers/cubeAdvanceSetting.js | 36 +++++++++++++++++--- webapp/app/js/controllers/cubeEdit.js | 6 ++-- webapp/app/js/controllers/cubeSchema.js | 10 ++++++ webapp/app/js/model/cubeConfig.js | 3 ++ .../cubeDesigner/advanced_settings.html | 14 ++++++++ 5 files changed, 63 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/f450414f/webapp/app/js/controllers/cubeAdvanceSetting.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/cubeAdvanceSetting.js b/webapp/app/js/controllers/cubeAdvanceSetting.js index 189cab9..c3110b5 100644 --- a/webapp/app/js/controllers/cubeAdvanceSetting.js +++ b/webapp/app/js/controllers/cubeAdvanceSetting.js @@ -41,16 +41,24 @@ KylinApp.controller('CubeAdvanceSettingCtrl', function ($scope, $modal,cubeConfi var rowkeyObj = { column:item.column, encoding:_encoding, - valueLength:_valueLength + valueLength:_valueLength, + isShardBy:item.isShardBy + } $scope.convertedRowkeys.push(rowkeyObj); }) - $scope.refreshRowKey = function(list,index,item){ + + $scope.rule={ + shardColumnAvailable:true + } + + $scope.refreshRowKey = function(list,index,item,checkShard){ var encoding = "dict"; var column = item.column; + var isShardBy = item.isShardBy; if(item.encoding!=="dict"){ if(item.encoding=="fixed_length" && item.valueLength){ encoding = "fixed_length:"+item.valueLength; @@ -63,9 +71,27 @@ KylinApp.controller('CubeAdvanceSettingCtrl', function ($scope, $modal,cubeConfi } $scope.cubeMetaFrame.rowkey.rowkey_columns[index].column = column; $scope.cubeMetaFrame.rowkey.rowkey_columns[index].encoding = encoding; + $scope.cubeMetaFrame.rowkey.rowkey_columns[index].isShardBy = isShardBy; + if(checkShard == true){ + $scope.checkShardByColumn(); + } + } + $scope.checkShardByColumn = function(){ + var shardRowkeyList = []; + angular.forEach($scope.cubeMetaFrame.rowkey.rowkey_columns,function(rowkey){ + if(rowkey.isShardBy == true){ + shardRowkeyList.push(rowkey.column); + } + }) + if(shardRowkeyList.length >1){ + $scope.rule.shardColumnAvailable = false; + }else{ + $scope.rule.shardColumnAvailable = true; + } } + $scope.resortRowkey = function(){ for(var i=0;i<$scope.convertedRowkeys.length;i++){ $scope.refreshRowKey($scope.convertedRowkeys,i,$scope.convertedRowkeys[i]); @@ -84,13 +110,15 @@ KylinApp.controller('CubeAdvanceSettingCtrl', function ($scope, $modal,cubeConfi var rowkeyObj = { column:"", encoding:"dict", - valueLength:0 + valueLength:0, + isShardBy:"false" } $scope.convertedRowkeys.push(rowkeyObj); $scope.cubeMetaFrame.rowkey.rowkey_columns.push({ column:'', - encoding:'dict' + encoding:'dict', + isShardBy:'false' }); }; http://git-wip-us.apache.org/repos/asf/kylin/blob/f450414f/webapp/app/js/controllers/cubeEdit.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js index 2cae518..eca6126 100755 --- a/webapp/app/js/controllers/cubeEdit.js +++ b/webapp/app/js/controllers/cubeEdit.js @@ -440,7 +440,8 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio if (i == tmpRowKeyColumns.length) { tmpRowKeyColumns.push({ "column": fk, - "encoding": "dict" + "encoding": "dict", + "isShardBy": "false" }); tmpAggregationItems.push(fk); @@ -467,7 +468,8 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio if (i == tmpRowKeyColumns.length) { tmpRowKeyColumns.push({ "column": rowkeyColumn, - "encoding": "dict" + "encoding": "dict", + "isShardBy": "false" }); tmpAggregationItems.push(rowkeyColumn); } http://git-wip-us.apache.org/repos/asf/kylin/blob/f450414f/webapp/app/js/controllers/cubeSchema.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js index f9d9dc1..be0c826 100755 --- a/webapp/app/js/controllers/cubeSchema.js +++ b/webapp/app/js/controllers/cubeSchema.js @@ -275,6 +275,16 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic } }) + var shardRowkeyList = []; + angular.forEach($scope.cubeMetaFrame.rowkey.rowkey_columns,function(rowkey){ + if(rowkey.isShardBy == true){ + shardRowkeyList.push(rowkey.column); + } + }) + if(shardRowkeyList.length >1){ + errors.push("At most one 'shard by' column is allowed."); + } + if($scope.cubeMetaFrame.region_size<0.01 || $scope.cubeMetaFrame.region_size>100){ errors.push("Please input a region size between 0.01 and 100 (G)."); } http://git-wip-us.apache.org/repos/asf/kylin/blob/f450414f/webapp/app/js/model/cubeConfig.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/model/cubeConfig.js b/webapp/app/js/model/cubeConfig.js index b5c77f9..42bba48 100644 --- a/webapp/app/js/model/cubeConfig.js +++ b/webapp/app/js/model/cubeConfig.js @@ -94,5 +94,8 @@ KylinApp.constant('cubeConfig', { 'HH:mm:ss', 'HH:mm', 'HH' + ], + rowKeyShardOptions:[ + true,false ] }); http://git-wip-us.apache.org/repos/asf/kylin/blob/f450414f/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 0499b60..b6d710e 100755 --- a/webapp/app/partials/cubeDesigner/advanced_settings.html +++ b/webapp/app/partials/cubeDesigner/advanced_settings.html @@ -211,6 +211,7 @@ <th style="width:200px;">Column</th> <th>Encoding</th> <th>Length</th> + <th>Shard By</th> <th ng-if="state.mode=='edit'"></th> </tr> </thead> @@ -255,6 +256,19 @@ <span ng-if="state.mode=='view'">{{rowkey_column.valueLength}}</span> </td> + <td> + <select ng-if="state.mode=='edit'" style="width:180px;" + chosen ng-model="rowkey_column.isShardBy" + tooltip="false by default" + data-placeholder="false by default" + ng-change="refreshRowKey(convertedRowkeys,$index,rowkey_column,true)" + ng-options="dt as dt for dt in cubeConfig.rowKeyShardOptions"> + <option value=""></option> + </select> + <small class="help-block red" ng-show="state.mode=='edit' && rule.shardColumnAvailable==false && rowkey_column.isShardBy == true">at most one 'shard by' column is allowed.</small> + <span ng-if="state.mode=='view'">{{rowkey_column.isShardBy}}</span> + </td> + <td ng-if="state.mode=='edit'"> <button class="btn btn-xs btn-info" ng-click="removeRowkey(convertedRowkeys, $index,rowkey_column)"><i