KYLIN 2396 GUI for Percentile pre aggregation implementation

Signed-off-by: lidongsjtu <lid...@apache.org>


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

Branch: refs/heads/master-hbase1.x
Commit: 28673a8126ec2ecff8c125c0ecf887ce2565362c
Parents: 6aaf667
Author: chenzhx <346839...@qq.com>
Authored: Fri Jan 20 18:00:20 2017 +0800
Committer: lidongsjtu <lid...@apache.org>
Committed: Mon Jan 23 11:32:46 2017 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeMeasures.js      | 18 +++++++
 webapp/app/js/model/cubeConfig.js              |  2 +-
 webapp/app/partials/cubeDesigner/measures.html | 54 ++++++++-------------
 3 files changed, 40 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/28673a81/webapp/app/js/controllers/cubeMeasures.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeMeasures.js 
b/webapp/app/js/controllers/cubeMeasures.js
index c8548ce..7c155fe 100644
--- a/webapp/app/js/controllers/cubeMeasures.js
+++ b/webapp/app/js/controllers/cubeMeasures.js
@@ -80,6 +80,7 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, 
$modal,MetaModel,cubes
       $scope.updateMeasureStatus.editIndex = index;
     }
     $scope.nextParameters = [];
+    $scope.measureParamValueColumn=$scope.getCommonMetricColumns();
     $scope.newMeasure = (!!measure)? jQuery.extend(true, 
{},measure):CubeDescModel.createMeasure();
     if(!!measure && measure.function.parameter.next_parameter){
       $scope.nextPara.value = measure.function.parameter.next_parameter.value;
@@ -93,6 +94,7 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, 
$modal,MetaModel,cubes
     }else{
       $scope.newMeasure.showDim=false;
     }
+    $scope.measureParamValueUpdate();
     if($scope.newMeasure.function.expression=="TOP_N"){
       $scope.convertedColumns=[];
       if($scope.newMeasure.function.configuration==null){
@@ -326,6 +328,19 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, 
$modal,MetaModel,cubes
       return false;
     }
   }
+
+  $scope.measureParamValueUpdate = function(){
+    if($scope.newMeasure.function.expression !== 'EXTENDED_COLUMN' && 
$scope.newMeasure.showDim==true){
+       $scope.measureParamValueColumn=$scope.getAllModelDimMeasureColumns();
+    }
+    if($scope.newMeasure.function.expression !== 'EXTENDED_COLUMN' && 
$scope.newMeasure.showDim==false){
+       $scope.measureParamValueColumn=$scope.getCommonMetricColumns();
+    }
+    if($scope.newMeasure.function.expression == 'EXTENDED_COLUMN'){
+      $scope.measureParamValueColumn=$scope.getExtendedHostColumn();
+    }
+  }
+
   //map right return type for param
   $scope.measureReturnTypeUpdate = function(){
 
@@ -393,6 +408,9 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, 
$modal,MetaModel,cubes
         case "COUNT":
           $scope.newMeasure.function.returntype = "bigint";
           break;
+        case "PERCENTILE":
+          $scope.newMeasure.function.returntype = "percentile(100)";
+          break;
         default:
           $scope.newMeasure.function.returntype = "";
           break;

http://git-wip-us.apache.org/repos/asf/kylin/blob/28673a81/webapp/app/js/model/cubeConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/cubeConfig.js 
b/webapp/app/js/model/cubeConfig.js
index 87413dc..35af1fc 100644
--- a/webapp/app/js/model/cubeConfig.js
+++ b/webapp/app/js/model/cubeConfig.js
@@ -20,7 +20,7 @@ KylinApp.constant('cubeConfig', {
 
   //~ Define metadata & class
   measureParamType: ['column', 'constant'],
-  measureExpressions: ['SUM', 'MIN', 'MAX', 'COUNT', 'COUNT_DISTINCT',"TOP_N", 
'RAW','EXTENDED_COLUMN'],
+  measureExpressions: ['SUM', 'MIN', 'MAX', 'COUNT', 'COUNT_DISTINCT',"TOP_N", 
'RAW','EXTENDED_COLUMN','PERCENTILE'],
   dimensionDataTypes: ["string", "tinyint", "int", "bigint", "date"],
   cubePartitionTypes: ['APPEND'],
   joinTypes: [

http://git-wip-us.apache.org/repos/asf/kylin/blob/28673a81/webapp/app/partials/cubeDesigner/measures.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/measures.html 
b/webapp/app/partials/cubeDesigner/measures.html
index 4d2d8ab..4a48843 100755
--- a/webapp/app/partials/cubeDesigner/measures.html
+++ b/webapp/app/partials/cubeDesigner/measures.html
@@ -104,7 +104,7 @@
                               <div class="col-xs-12 col-sm-6">
                                   <select class="form-control"
                                       ng-init="newMeasure.function.expression 
= 
(!!newMeasure.function.expression)?newMeasure.function.expression:cubeConfig.dftSelections.measureExpression"
 chosen ng-model="newMeasure.function.expression" required
-                                      ng-change="measureReturnTypeUpdate();"
+                                      
ng-change="measureReturnTypeUpdate();measureParamValueUpdate();"
                                       ng-options="me as me for me in 
cubeConfig.measureExpressions">
                                       <option value=""></option>
                                   </select>
@@ -144,35 +144,23 @@
 
 
                               <div class="col-xs-12 col-sm-6">
-                                  <span class="font-color-default"
-                                      
ng-if="newMeasure.function.parameter.type == 'constant'"
-                                      
ng-init="newMeasure.function.parameter.value = 1"><b>&nbsp;&nbsp;1</b></span>
-                                <!--!COUNT_DISTINCT-->
-
-                                <select class="form-control" chosen
-                                        
ng-if="newMeasure.function.parameter.type == 'column' && 
newMeasure.function.expression !== 'EXTENDED_COLUMN' && 
newMeasure.showDim==true "
-                                        
ng-model="newMeasure.function.parameter.value" required
-                                        ng-change="measureReturnTypeUpdate();"
-                                        ng-options="column as column for 
column in getAllModelDimMeasureColumns(newMeasure)" >
-                                  <option value="">-- Select a Column 
--</option>
-                                </select>
-
+                                <span class="font-color-default"
+                                  ng-if="newMeasure.function.parameter.type == 
'constant'"
+                                  ng-init="newMeasure.function.parameter.value 
= 1">
+                                  <b>&nbsp;&nbsp;1</b>
+                                </span>
+                                  <!--!COUNT_DISTINCT-->
                                 <select class="form-control" chosen
-                                        
ng-if="newMeasure.function.parameter.type == 'column' && 
newMeasure.function.expression !== 'EXTENDED_COLUMN' && 
newMeasure.showDim==false "
-                                        
ng-model="newMeasure.function.parameter.value" required
-                                        ng-change="measureReturnTypeUpdate();"
-                                        ng-options="column as column for 
column in getCommonMetricColumns(newMeasure)" >
-                                  <option value="">-- Select a Column 
--</option>
-                                </select>
-                                <select class="form-control" chosen
-                                        ng-if="newMeasure.function.expression 
== 'EXTENDED_COLUMN'"
-                                        
ng-model="newMeasure.function.parameter.value" required
-                                        ng-change="measureReturnTypeUpdate();"
-                                        ng-options="column as column for 
column in getExtendedHostColumn()" >
-                                  <option value="">-- Select a Column 
--</option>
-                                </select>
-                              </div>
-                              <label ng-if="newMeasure.function.parameter.type 
== 'column'&& newMeasure.function.expression !== 'EXTENDED_COLUMN'"><input 
type="checkbox" ng-model="newMeasure.showDim" />&nbsp;Also Show 
Dimensions</label>
+                                      
ng-if="newMeasure.function.parameter.type == 'column'"
+                                      
ng-model="newMeasure.function.parameter.value" required
+                                      ng-change="measureReturnTypeUpdate();"
+                                      ng-options="column as column for column 
in measureParamValueColumn" >
+                                <option 
value="">{{dataKylin.cube.cubeMSParamValueSelect}}</option>
+                              </select>
+                            </div>
+                            <label ng-if="newMeasure.function.parameter.type 
== 'column'&& newMeasure.function.expression !== 'EXTENDED_COLUMN'">
+                              <input type="checkbox" 
ng-model="newMeasure.showDim" ng-change="measureParamValueUpdate();" 
/>&nbsp;Also Show Dimensions
+                            </label>
                           </div>
                       </div>
 
@@ -221,10 +209,10 @@
                                    
ng-init="newMeasure.function.returntype=newMeasure.function.returntype?newMeasure.function.returntype:'extendedcolumn(100)'"
                                    ng-model="newMeasure.function.returntype" 
required />
 
-                                        <span class="font-color-default"
-                                              
ng-if="newMeasure.function.expression != 'COUNT_DISTINCT' && 
newMeasure.function.expression != 'TOP_N' && newMeasure.function.expression != 
'EXTENDED_COLUMN' "
-                                        
><b>&nbsp;&nbsp;{{newMeasure.function.returntype | uppercase}}</b>
-                                        </span>
+                            <span class="font-color-default"
+                                  ng-if="newMeasure.function.expression != 
'COUNT_DISTINCT' && newMeasure.function.expression != 'TOP_N' && 
newMeasure.function.expression != 'EXTENDED_COLUMN' ">
+                              <b>&nbsp;&nbsp;{{newMeasure.function.returntype 
| uppercase}}</b>
+                            </span>
                           </div>
                         </div>
                       </div>

Reply via email to