kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhongj...@apache.org
Subject incubator-kylin git commit: use fk on fact table replace pk on lookup table when generate rowkey
Date Thu, 11 Jun 2015 02:54:45 GMT
Repository: incubator-kylin
Updated Branches:
  refs/heads/0.8.0 006e68e37 -> 090e90884


use fk on fact table replace pk on lookup table when generate rowkey


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

Branch: refs/heads/0.8.0
Commit: 090e908844af00cd632c632464ced4707d9022e2
Parents: 006e68e
Author: jiazhong <jiazhong@ebay.com>
Authored: Thu Jun 11 10:54:03 2015 +0800
Committer: jiazhong <jiazhong@ebay.com>
Committed: Thu Jun 11 10:54:32 2015 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeEdit.js | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/090e9088/webapp/app/js/controllers/cubeEdit.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js
index cf8ab95..4c3a82c 100755
--- a/webapp/app/js/controllers/cubeEdit.js
+++ b/webapp/app/js/controllers/cubeEdit.js
@@ -286,11 +286,19 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams,
$locatio
 
     function reGenerateRowKey(){
         $log.log("reGen rowkey & agg group");
+        var fk_pk = {};
         var tmpRowKeyColumns = [];
         var tmpAggregationItems = [];//put all aggregation item
         var hierarchyItemArray = [];//put all hierarchy items
         angular.forEach(cubesManager.cubeMetaFrame.dimensions, function (dimension, index)
{
 
+          // build fk_pk map
+          angular.forEach($scope.metaModel.model.lookups, function (_lookup, index) {
+            for (var i = 0; i < _lookup.join.foreign_key.length; i++) {
+              fk_pk[_lookup.join.primary_key[i]] = _lookup.join.foreign_key[i];
+            }
+          });
+
            //derived column
             if(dimension.derived&&dimension.derived.length){
                 var lookup = _.find($scope.metaModel.model.lookups,function(lookup){return
lookup.table==dimension.table});
@@ -333,6 +341,12 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams,
$locatio
             if(dimension.hierarchy && dimension.column.length){
                 var hierarchyUnit = [];
                 angular.forEach(dimension.column, function (hier_column, index) {
+
+                  //use fk instead of fk as rowkey and aggregation item in hierarchy
+                  if (hier_column in fk_pk) {
+                    hier_column = fk_pk[hier_column];
+                  }
+
                     for (var i = 0; i < tmpRowKeyColumns.length; i++) {
                         if(tmpRowKeyColumns[i].column == hier_column)
                             break;
@@ -419,7 +433,16 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams,
$locatio
                 }
             });
 
+          //distinct hierarchyItem
           var hierarchyItems = hierarchyItemArray.join().split(",");
+          var _hierarchyItems = [];
+          angular.forEach(hierarchyItems, function (item, index) {
+            if (_hierarchyItems.indexOf(item) == -1) {
+              _hierarchyItems.push(item);
+            }
+          });
+          hierarchyItems = _hierarchyItems;
+
           var unHierarchyItems = increasedData(hierarchyItems,newUniqAggregationItem);
           //hierarchyItems
           var increasedDataGroups = sliceGroupItemToGroups(unHierarchyItems);


Mime
View raw message