You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ch...@apache.org on 2017/07/14 02:13:03 UTC
kylin git commit: KYLIN 2616 COUNT DISTINCT SUPPORT MULTIPLE COLUMN
Repository: kylin
Updated Branches:
refs/heads/master 933a5f614 -> 961546334
KYLIN 2616 COUNT DISTINCT SUPPORT MULTIPLE COLUMN
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/96154633
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/96154633
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/96154633
Branch: refs/heads/master
Commit: 96154633475ede1ee83cc0a5c9a5b5a62f329fa5
Parents: 933a5f6
Author: chenzhx <34...@qq.com>
Authored: Thu Jul 13 16:10:14 2017 +0800
Committer: chenzhx <34...@qq.com>
Committed: Thu Jul 13 16:10:14 2017 +0800
----------------------------------------------------------------------
webapp/app/js/controllers/cubeMeasures.js | 44 ++++++++++++++++-----
webapp/app/partials/cubeDesigner/measures.html | 18 ++++-----
2 files changed, 44 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/96154633/webapp/app/js/controllers/cubeMeasures.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeMeasures.js b/webapp/app/js/controllers/cubeMeasures.js
index c598fde..2b86683 100644
--- a/webapp/app/js/controllers/cubeMeasures.js
+++ b/webapp/app/js/controllers/cubeMeasures.js
@@ -106,6 +106,12 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes
}
};
}
+ if ($scope.newMeasure.function.expression === 'COUNT_DISTINCT') {
+ $scope.convertedColumns=[];
+ if ($scope.newMeasure.function.parameter.next_parameter) {
+ $scope.recursion($scope.newMeasure.function.parameter.next_parameter, $scope.convertedColumns)
+ }
+ }
};
@@ -212,13 +218,34 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes
$scope.newMeasure.function.configuration[versionKey]=version;
});
}
+ if ($scope.newMeasure.function.expression === 'COUNT_DISTINCT' ) {
+
+ var hasExisted = [];
+
+ for (var column in $scope.convertedColumns){
+ if(hasExisted.indexOf($scope.convertedColumns[column].name)==-1){
+ hasExisted.push($scope.convertedColumns[column].name);
+ }
+ else{
+ SweetAlert.swal('', 'The column named ['+$scope.convertedColumns[column].name+'] already exits.', 'warning');
+ return false;
+ }
+ }
+ $scope.nextPara.next_parameter={};
+ if ($scope.convertedColumns.length > 0) {
+ $scope.groupby($scope.nextPara);
+ } else {
+ $scope.nextPara=null;
+ $scope.newMeasure.function.parameter.next_parameter=null;
+ }
+ }
if ($scope.isNameDuplicated($scope.cubeMetaFrame.measures, $scope.newMeasure) == true) {
SweetAlert.swal('', 'The measure name: ' + $scope.newMeasure.name + ' is duplicated', 'warning');
return false;
}
- if($scope.nextPara.value!=="" && ($scope.newMeasure.function.expression == 'EXTENDED_COLUMN' || $scope.newMeasure.function.expression == 'TOP_N')){
+ if($scope.nextPara && $scope.nextPara.value!=="" && ($scope.newMeasure.function.expression == 'EXTENDED_COLUMN' || $scope.newMeasure.function.expression == 'TOP_N'||$scope.newMeasure.function.expression == 'COUNT_DISTINCT')){
$scope.newMeasure.function.parameter.next_parameter = jQuery.extend(true,{},$scope.nextPara);
}
@@ -294,14 +321,13 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes
return false;
}
}
- $scope.converted = function (next_parameter) {
- if (next_parameter != null) {
- $scope.groupby.push(next_parameter.value);
- converted(next_parameter.next_parameter)
- }
- else {
- $scope.groupby.push(next_parameter.value);
- return false;
+
+ $scope.recursion = function (parameter, list) {
+ list.push({name: parameter.value})
+ if (parameter.next_parameter) {
+ $scope.recursion(parameter.next_parameter, list)
+ } else {
+ return
}
}
http://git-wip-us.apache.org/repos/asf/kylin/blob/96154633/webapp/app/partials/cubeDesigner/measures.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/measures.html b/webapp/app/partials/cubeDesigner/measures.html
index df69b78..89c7142 100755
--- a/webapp/app/partials/cubeDesigner/measures.html
+++ b/webapp/app/partials/cubeDesigner/measures.html
@@ -218,22 +218,22 @@
</div>
<!--Group by Column-->
- <div class="form-group" ng-if="newMeasure.function.expression == 'TOP_N'" >
+ <div class="form-group" ng-if="newMeasure.function.expression === 'TOP_N'||newMeasure.function.expression === 'COUNT_DISTINCT'" >
<div class="row">
<label class="col-xs-12 col-sm-3 control-label no-padding-right font-color-default">
<b>Group by Column</b>
</label>
<div class="form-group large-popover" >
<div class="box-body">
- <table style="margin-left:width:92%"
+ <table style="width:92%"
class="table table-hover table-bordered list">
<thead>
<tr>
<th style="width:40px;">ID</th>
<th style="width:300px;">Column</th>
- <th style="width:140px;">Encoding</th>
- <th >Length</th>
- <th ng-if="state.mode=='edit'"></th>
+ <th style="width:140px;" ng-if="newMeasure.function.expression === 'TOP_N'">Encoding</th>
+ <th ng-if="newMeasure.function.expression === 'TOP_N'">Length</th>
+ <th style="width:50px;" ng-if="state.mode=='edit'"></th>
</tr>
</thead>
@@ -248,22 +248,22 @@
</td>
<!--Column Name -->
<td>
- <select class="form-control" chosen ng-if="nextPara.type !== 'constant'" required
+ <select style="width:270px" chosen ng-if="nextPara.type !== 'constant'" required
ng-model="groupby_column.name"
ng-options="column as column for column in getAllModelDimColumns()" >
<option value="">--Select A Column--</option>
</select>
</td>
<!--Column Encoding -->
- <td>
- <select ng-if="state.mode=='edit'" style="width: 100%"
+ <td ng-if="newMeasure.function.expression === 'TOP_N'">
+ <select ng-if="state.mode=='edit'" style="width:100%"
chosen ng-model="groupby_column.encoding"
ng-change="refreshGroupBy(convertedColumns,$index,groupby_column)"
ng-options="dt.value as dt.name for dt in getEncodings(groupby_column.name)">
<option value=""></option>
</select>
</td>
- <td>
+ <td ng-if="newMeasure.function.expression === 'TOP_N'">
<!--Column Length -->
<input type="text" class="form-control" placeholder="Column Length.." ng-if="state.mode=='edit'"
tooltip="group by column length.." tooltip-trigger="focus"