kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [34/50] incubator-kylin git commit: measure update rule fix
Date Tue, 03 Mar 2015 10:28:48 GMT
measure update rule fix


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

Branch: refs/heads/master
Commit: 80a50655b4290a845278ec5e24d7a4a3145ff766
Parents: 2b01dcc
Author: jiazhong <jiazhong@ebay.com>
Authored: Fri Feb 27 13:54:15 2015 +0800
Committer: jiazhong <jiazhong@ebay.com>
Committed: Fri Feb 27 13:54:15 2015 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeEdit.js          |  9 +++++++++
 webapp/app/js/controllers/cubeSchema.js        | 16 ++++++++++++++++
 webapp/app/partials/cubeDesigner/measures.html | 14 ++++++--------
 3 files changed, 31 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/80a50655/webapp/app/js/controllers/cubeEdit.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js
index c2f0b5a..0e05077 100755
--- a/webapp/app/js/controllers/cubeEdit.js
+++ b/webapp/app/js/controllers/cubeEdit.js
@@ -36,6 +36,15 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams,
$locatio
         return temp;
     };
 
+    $scope.getColumnType = function (_column,table){
+        var columns = $scope.getColumnsByTable(table);
+        angular.forEach(columns,function(column){
+            if(_column===column.name){
+                return column.type;
+            }
+        });
+    };
+
     var ColFamily = function () {
         var index = 1;
         return function () {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/80a50655/webapp/app/js/controllers/cubeSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
old mode 100644
new mode 100755
index e03808c..4bb5762
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -107,6 +107,22 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService,
UserServic
         $scope.newMeasure = null;
     };
 
+    // !count !count distinct
+    $scope.measureParamValueUpdate = function(){
+        if(newMeasure.function.expression!=="COUNT"&&newMeasure.function.expression!=="COUNT_DISTINCT"){
+
+            var column = $scope.newMeasure.function.parameter.value;
+
+
+            switch(newMeasure.function.expression){
+                case "SUM":
+                    var colType = $scope.getColumnType(column, $scope.metaModel.model.fact_table);
+                    $log.log(colType);
+                    break;
+            }
+        }
+    }
+
     $scope.addNewRowkeyColumn = function () {
         $scope.cubeMetaFrame.rowkey.rowkey_columns.push({
             "column": "",

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/80a50655/webapp/app/partials/cubeDesigner/measures.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/measures.html b/webapp/app/partials/cubeDesigner/measures.html
index ef7c12f..9a932bd 100755
--- a/webapp/app/partials/cubeDesigner/measures.html
+++ b/webapp/app/partials/cubeDesigner/measures.html
@@ -110,7 +110,7 @@
                             <label class="col-xs-12 col-sm-3 control-label no-padding-right
font-color-default"><b>Expression</b></label>
                             <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-init="newMeasure.function.expression = (!!newMeasure.function.expression)?newMeasure.function.expression:cubeConfig.dftSelections.measureExpression"
chosen ng-model="newMeasure.function.expression" required
                                     ng-options="me as me for me in cubeConfig.measureExpressions">
                                     <option value=""></option>
                                 </select>
@@ -146,6 +146,7 @@
                                 <select class="form-control" chosen
                                     ng-if="newMeasure.function.parameter.type == 'column'"
                                     ng-model="newMeasure.function.parameter.value"
+                                    ng-change="measureParamValueUpdate();"
                                     ng-options="columns.name as columns.name for columns
in getColumnsByTable(metaModel.model.fact_table)" >
                                     <option value="">-- Select a Fact Table Column
--</option>
                                 </select>
@@ -158,13 +159,6 @@
                             <label class="col-xs-12 col-sm-3 control-label no-padding-right
font-color-default"><b>Return Type</b></label>
                             <div class="col-xs-12 col-sm-6">
                                 <select class="form-control"
-                                    ng-if="newMeasure.function.expression != 'COUNT_DISTINCT'
&& newMeasure.function.expression != 'COUNT' "
-                                    ng-init="newMeasure.function.returntype = (!!newMeasure.function.returntype)?newMeasure.function.returntype:cubeConfig.dftSelections.measureDataType.value"
-                                    chosen ng-model="newMeasure.function.returntype" required
-                                    ng-options="mdt.value as mdt.name for mdt in cubeConfig.measureDataTypes">
-                                    <option value=""></option>
-                                </select>
-                                <select class="form-control"
                                     ng-if="newMeasure.function.expression == 'COUNT_DISTINCT'"
                                     ng-init="newMeasure.function.returntype = (!!newMeasure.function.returntype)?newMeasure.function.returntype:cubeConfig.dftSelections.distinctDataType.value"
                                     chosen ng-model="newMeasure.function.returntype" required
@@ -175,6 +169,10 @@
                                     ng-if="newMeasure.function.expression == 'COUNT'"
                                     ng-init="newMeasure.function.returntype= 'bigint' "><b>&nbsp;&nbsp;BIGINT</b>
                                 </span>
+                                <span class="font-color-default"
+                                      ng-if="newMeasure.function.expression != 'COUNT_DISTINCT'
&& newMeasure.function.expression != 'COUNT' "
+                                     ><b>&nbsp;&nbsp;{{newMeasure.function.returntype}}</b>
+                                </span>
                             </div>
                         </div>
                     </div>


Mime
View raw message