You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2016/10/24 22:16:38 UTC

[1/5] kylin git commit: KYLIN 1321 Add derived checkbox for lookup table columns on [Forced Update!]

Repository: kylin
Updated Branches:
  refs/heads/KYLIN-1971 5793c19f4 -> 9b4209bed (forced update)


KYLIN 1321 Add derived checkbox for lookup table columns on

Signed-off-by: Jason <ji...@163.com>


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

Branch: refs/heads/KYLIN-1971
Commit: 5a4486851523117e2944e57cd805d8c2d087078c
Parents: 2651640
Author: chenzhx <34...@qq.com>
Authored: Mon Oct 24 10:49:05 2016 +0800
Committer: Jason <ji...@163.com>
Committed: Mon Oct 24 14:46:24 2016 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeDimensions.js     | 133 ++++++++------
 .../app/partials/cubeDesigner/dimensions.html   | 173 ++++++++-----------
 2 files changed, 158 insertions(+), 148 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/5a448685/webapp/app/js/controllers/cubeDimensions.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeDimensions.js b/webapp/app/js/controllers/cubeDimensions.js
index ab07451..5525fe4 100644
--- a/webapp/app/js/controllers/cubeDimensions.js
+++ b/webapp/app/js/controllers/cubeDimensions.js
@@ -18,7 +18,7 @@
 
 'use strict';
 
-KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cubesManager) {
+KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cubesManager,SweetAlert) {
 
     $scope.cubeManager = cubesManager;
     // Available columns list derived from cube data model.
@@ -74,7 +74,8 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
             cols[i].isLookup = false;
 
             // Default not selected and not disabled.
-            factSelectAvailable[cols[i].name] = {selected: false, disabled: false};
+            factSelectAvailable[cols[i].name] = {name:cols[i].name ,selected: false, disabled: false};
+
         }
 
         $scope.availableColumns[factTable] = cols;
@@ -95,7 +96,7 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
                 cols2[k].isLookup = true;
 
                 // Default not selected and not disabled.
-                lookupSelectAvailable[cols2[k].name] = {selected: false, disabled: false};
+                lookupSelectAvailable[cols2[k].name] = {name:cols2[k].table+"_derived",selected: false, disabled: false};
             }
 
             $scope.availableColumns[lookups[j].table] = cols2;
@@ -112,8 +113,12 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
             var cols = dimCols(dim);
 
             angular.forEach(cols, function (colName) {
-                $scope.selectedColumns[dim.table][colName] = {selected: true, disabled: true};
-            });
+              if(dim.derived){
+                 $scope.selectedColumns[dim.table][colName] = {name:dim.name, selected: true, disabled: true,normal:"false"};
+              }else{
+                 $scope.selectedColumns[dim.table][colName] = {name:dim.name, selected: true, disabled: true,normal:"true"};
+              }
+           });
         });
     };
 
@@ -130,14 +135,14 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
     };
 
     // Init the dimension, dimension name default as the column key. TODO new cube schema change.
-    var Dimension = function (table, selectedCols, dimType) {
+    var Dimension = function (name, table, selectedCols, dimType) {
         var origin = {name: '', table: table,derived:null,column:null};
 
         switch (dimType) {
             case 'normal':
                 // Default name as 1st column name.
                 if (table && selectedCols.length) {
-                    origin.name = table + '.' + selectedCols[0];
+                    origin.name = name;
                 }
 
                 origin.column = selectedCols[0];
@@ -145,20 +150,11 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
 
             case 'derived':
                 if (table && selectedCols.length) {
-                    origin.name = table + '_derived';
+                    origin.name = name;
                 }
 
                 origin.derived = selectedCols;
                 break;
-
-            //case 'hierarchy':
-            //    if (table && selectedCols.length) {
-            //        origin.name = table + '_hierarchy';
-            //    }
-            //
-            //    origin.hierarchy = true;
-            //    origin.column = selectedCols;
-            //    break;
         }
 
         return origin;
@@ -226,26 +222,6 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
 
         $scope.checkDimension = function(){
             var errors = [];
-            // null validate
-
-            //if($scope.dimType[0]=="hierarchy"){
-            //    if($scope.newDimension.column.length<2){
-            //        errors.push("Please define at least 2 hierarchy columns.");
-            //    }else{
-            //        for(var i = 0;i<$scope.newDimension.column.length;i++){
-            //            if($scope.newDimension.column[i]===""){
-            //                errors.push("Hierarchy value can't be null.");
-            //                break;
-            //            }
-            //        }
-            //        var _columns = angular.copy($scope.newDimension.column).sort();
-            //        for(var i = 0;i<_columns.length-1;i++){
-            //            if(_columns[i]==_columns[i+1]&&_columns[i]!==""){
-            //                errors.push("Duplicate column "+_columns[i]+".");
-            //            }
-            //        }
-            //    }
-            //}
 
             if($scope.dimType[0]=="derived"){
                 if(!$scope.newDimension.derived.length){
@@ -323,7 +299,11 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
 
         var cols = dimCols(dim);
         angular.forEach(cols, function (colName) {
-            $scope.selectedColumns[dim.table][colName] = {selected: false, disabled: false};
+            if(dim.table==$scope.metaModel.model.fact_table){
+               $scope.selectedColumns[dim.table][colName] = {name:colName,selected: false, disabled: false};
+            }else{
+               $scope.selectedColumns[dim.table][colName] = {name:dim.table+"_derived",selected: false, disabled: false};
+            }
         });
     };
 
@@ -370,12 +350,18 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
 
         angular.forEach($scope.selectedColumns, function (value, table) {
             angular.forEach(value, function (status, colName) {
-                if (status.selected && !status.disabled) {
+                if (status.selected) {
                     if (!selectedCols[table]) {
                         selectedCols[table] = [];
                     }
 
-                    selectedCols[table].push(colName);
+                    var cols={
+                         name:status.name,
+                         col:colName,
+                         normal:status.normal,
+                         selected:status.selected
+                    }
+                    selectedCols[table].push(cols);
                 }
             });
         });
@@ -386,30 +372,79 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
     // Auto generate dimensions.
     $scope.autoGenDims = function () {
         var selectedCols = $scope.getSelectedCols();
-
+        dimList=[];
         angular.forEach(selectedCols, function (cols, table) {
             if ($scope.metaModel.model.fact_table == table) {
                 // Fact table: for each selected column, create one normal dimension.
                 for (var i = 0; i < cols.length; i++) {
-                    dimList.push(Dimension(table, [cols[i]], 'normal'));
+                    dimList.push(Dimension(cols[i].name, table, [cols[i].col], 'normal'));
                 }
             } else {
                 // Per lookup table, create one derived dimension for all its selected columns;
-                if (cols.length) {
-                    dimList.push(Dimension(table, cols, 'derived'));
+                for (var i = 0; i < cols.length; i++) {
+                    if(cols[i].normal=="true"){
+                       dimList.push(Dimension(cols[i].name, table, [cols[i].col], 'normal'));
+                    }else{
+                        dimList.push(Dimension(cols[i].name, table, [cols[i].col], 'derived'));
+                    }
                 }
             }
         });
+        $scope.cubeMetaFrame.dimensions = dimList;
+
     };
 
+    $scope.autoChange= function(table,name){
+        if($scope.selectedColumns[table][name].selected==false){
+             $scope.selectedColumns[table][name].normal=null;
+             if(table==$scope.metaModel.model.fact_table){
+                 $scope.selectedColumns[table][name].name=name;
+             }else{
+                 $scope.selectedColumns[table][name].name=table+"_derived";
+             }
+        }else{
+             if($scope.metaModel.model.fact_table!=table){
+                 $scope.selectedColumns[table][name].normal="false";
+             }
+        }
+
+    }
+    $scope.checkAutoDimension=function(){
+        var nameNull=false;
+        angular.forEach($scope.selectedColumns, function (value, table) {
+             angular.forEach(value, function (status, colName) {
+                  if (status.selected) {
+                      if(status.name==""){
+                           SweetAlert.swal('', "The name is requested.", 'warning');
+                           nameNull=true;
+                       }
+
+                  }
+             });
+        });
+        if(nameNull==true){
+             return false;
+        }else{
+             return true;
+        }
+    }
+
+    $scope.addNewDimension = function(newDimension){
+           if(newDimension.derived==null){
+             newDimension.derived=[];
+           }
+           newDimension.derived.push('');
+    }
+
+
     // Just reset the selected status of columns.
     $scope.resetGenDims = function () {
         var selectedCols = $scope.getSelectedCols();
-
-        angular.forEach(selectedCols, function (cols, table) {
-            for (var i = 0; i < cols.length; i++) {
-                $scope.selectedColumns[table][cols[i]].selected = false;
-            }
+        angular.forEach($scope.selectedColumns, function (value, table) {
+            angular.forEach(value, function (status, colName) {
+                 status.selected=false;
+                 status.normal=null;
+            });
         });
     };
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/5a448685/webapp/app/partials/cubeDesigner/dimensions.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/dimensions.html b/webapp/app/partials/cubeDesigner/dimensions.html
index a0a1506..4d48167 100644
--- a/webapp/app/partials/cubeDesigner/dimensions.html
+++ b/webapp/app/partials/cubeDesigner/dimensions.html
@@ -186,52 +186,6 @@
                             </div>
                         </div>
                     </div>
-
-                    <!--Hierarchy Dimension-->
-                    <div class="form-group" ng-if="dimType.indexOf('hierarchy') >= 0">
-                        <div class="row">
-                            <div class="col-sm-6 col-sm-offset-3">
-                                <div ui-sortable="{containment: 'parent', placeholder: 'hierarchy-item-placeholder', forcePlaceholderSize: true, opacity: 0.8}"
-                                     ng-model="newDimension.column" class="hierarchy-container">
-                                    <div ng-repeat="hierarchyIndex in [] | range: newDimension.column.length" class="hierarchy-item">
-                                        <div class="row">
-                                            <div class="col-xs-2">
-                                                <span class="badge">{{$index + 1}}</span>
-                                            </div>
-                                            <div class="col-xs-8">
-                                                <select chosen style="width: 100%"
-                                                        data-placeholder="Dimension Hierarchy Column"
-                                                        ng-model="newDimension.column[$index]"
-                                                        ng-options="columns.name as columns.name for columns in getDimColumnsByTable(newDimension.table)" >
-                                                    <option value="">-- Select Column --</option>
-                                                </select>
-                                            </div>
-                                            <div class="col-xs-2">
-                                                <button type="button" class="pull-right btn btn-xs btn-danger" style="cursor: pointer " tooltip="Delete"
-                                                        ng-click="newDimension.column.splice($index, 1);">
-                                                    <i class="fa fa-trash-o"></i>
-                                                </button>
-                                            </div>
-                                        </div>
-                                    </div>
-                                </div>
-
-                                <div class="space-8"></div>
-
-                                <div class="row">
-                                    <div class="col-xs-4">
-                                        <button class="btn btn-xs btn-info"
-                                                ng-click="newDimension.column.push('');">
-                                            <i class="fa fa-plus"></i> New Hierarchy</button>
-                                    </div>
-                                    <div class="col-xs-8">
-                                        <p class="help-block">Drag level into the order you prefer.</p>
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-
                     <!--Derived Dimension-->
                     <div ng-if="dimType.indexOf('derived') >= 0">
                         <div class="form-group">
@@ -251,35 +205,13 @@
                                             <div class="space-4"></div>
                                         </div>
                                     </div>
-                                    <button class="btn btn-xs btn-info" ng-click="newDimension.derived.push('');">
+                                    <button class="btn btn-xs btn-info" ng-click="addNewDimension(newDimension);">
                                         <i class="fa fa-plus"></i> New Derived</button>
                                 </div>
                             </div>
                         </div>
                     </div>
                 </div>
-
-                <!--Tips-->
-                <div class="col-xs-4">
-                    <div class="box box-solid">
-                        <div class="box-header">
-                            <h4 class="box-title">Tips</h4>
-                        </div>
-                        <div class="box-body">
-                            <div class="row">
-                                <div class="col-xs-12">
-                                    <ol class="text-info">
-                                        <li>Type in any input box for auto suggestion</li>
-                                        <li>Pick up Fact Table from Star Schema Tables first</li>
-                                        <li>Data Type should match with Hive Table's Data Type</li>
-                                        <li>Join Type have to be same as will be used in query</li>
-                                        <li>Using Derived for One-One relationship between columns, like ID and Name</li>
-                                    </ol>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                </div>
             </div>
             </ng-form>
         </div>
@@ -291,31 +223,71 @@
 
 
     <script type="text/ng-template" id="autoGenDimension.html">
-        <div class="modal-header">
-            <h4 class="box-title lighter">Auto Generate Dimensions <small>This is a helper for you to batch generate dimensions.</small></h4>
+        <div class="modal-header large-popover">
+            <h4 class="box-title lighter">Auto Generate Dimensions <small>This is a helper for you to batch generate dimensions.</small><i kylinpopover placement="right" title="Auto Generate Rules" template="AutoDimensionsTip.html" class="fa fa-info-circle"></i></h4>
         </div>
         <div class="modal-body">
             <div class="row">
-                <div class="col-xs-8">
+                <div class="col-xs-12">
                     <div class="box box-solid">
                         <div class="box-header"><h4>Columns</h4></div>
                         <div class="box-body">
-                            <ul class="list-unstyled columns-region">
-                                <li ng-repeat="table in availableTables track by $index">
-                                    <h5 class="table-name-underline">
-                                        <b>{{table}}</b>{{$index == 0 ? ' [Fact Table]' : ' [Lookup Table]'}}
-                                    </h5>
-                                    <ul class="list-unstyled">
-                                        <li ng-repeat="col in availableColumns[table] track by col.table + '.' + col.name">
-                                            <label>
-                                                <input type="checkbox" ng-model="selectedColumns[table][col.name].selected"
-                                                       ng-disabled="selectedColumns[table][col.name].disabled">
-                                                {{col.name}}
-                                            </label>
-                                        </li>
-                                    </ul>
-                                </li>
-                            </ul>
+                          <ul class="list-unstyled columns-region">
+                            <accordion close-others=false>
+                              <!--FactTable-->
+                              <div ng-repeat="table in availableTables track by $index" ng-if="$index == 0" accordion-group class="panel-default " heading="{{table}}{{dataKylin.cube.cubeDSFactTable}}" is-open=true>
+                                <table class="table table-striped table-hover ng-scope">
+                                  <tr >
+                                    <td class="col-xs-1"></td>
+                                    <td class="col-xs-4"><label>Name</label></td>
+                                    <td class="col-xs-3"><label>Columns</label></td>
+                                    <td colspan="2" class="col-xs-4"></td>
+                                  </tr>
+                                  <tr ng-repeat="col in availableColumns[table] track by col.table + '.' + col.name" >
+                                    <td >
+                                      <input type="checkbox" ng-model="selectedColumns[table][col.name].selected"
+                                             ng-disabled="selectedColumns[table][col.name].disabled"  >
+                                    </td>
+                                    <td >
+                                      <input type="text"  placeholder={{col.name}} ng-model="selectedColumns[table][col.name].name" ng-disabled="!selectedColumns[table][col.name].selected" style="width:90%;">
+                                    </td>
+                                    <td>
+                                      {{col.name}}
+                                    </td>
+                                  </tr>
+                                </table>
+                              </div>
+                              <!--LookUp Table-->
+                              <div ng-repeat="table in availableTables track by $index" ng-if="$index > 0" accordion-group class="panel-default" heading="{{table}}{{dataKylin.cube.cubeDSLookupTable}}">
+                                <table class="table table-striped table-hover ng-scope">
+                                  <tr class="row" >
+                                    <td class="col-xs-1"></td>
+                                    <td class="col-xs-4"><label>Name</label></td>
+                                    <td class="col-xs-3"><label>Columns</label></td>
+                                    <td colspan="2" class="col-xs-4"></td>
+                                  </tr>
+                                  <tr ng-repeat="col in availableColumns[table] track by col.table + '.' + col.name" class="row">
+                                    <td class=>
+                                      <input type="checkbox" ng-model="selectedColumns[table][col.name].selected"
+                                             ng-disabled="selectedColumns[table][col.name].disabled"  ng-change="autoChange(table,col.name)">
+                                    </td>
+                                    <td >
+                                      <input type="text" ng-model="selectedColumns[table][col.name].name" placeholder={{table}}_derived  ng-disabled="!selectedColumns[table][col.name].selected" style="width:90%;">
+                                    </td>
+                                    <td >
+                                      {{col.name}}
+                                    </td>
+                                    <td  >
+                                      <label> <input type="radio" ng-model="selectedColumns[table][col.name].normal" value="true" ng-disabled="!selectedColumns[table][col.name].selected"> Normal </label>
+                                    </td>
+                                    <td >
+                                      <label> <input type="radio" ng-model="selectedColumns[table][col.name].normal" value="false" ng-disabled="!selectedColumns[table][col.name].selected"> Derived </label>
+                                    </td>
+                                  </tr>
+                                </table>
+                              </div>
+                            </accordion>
+                          </ul>
                         </div>
                     </div>
                 </div>
@@ -324,27 +296,30 @@
                 <div class="col-xs-4">
                     <div class="box box-solid">
                         <div class="box-header">
-                            <h4 class="box-title">Auto Generate Rules</h4>
+                            <h4 class="box-title"></h4>
                         </div>
                         <div class="box-body">
-                            <div class="row">
-                                <div class="col-xs-12">
-                                    <ol class="text-info">
-                                        <li>Column is disabled once there is already a dimension referred this column.</li>
-                                        <li>In fact table: one normal dimension will be auto generated per column.</li>
-                                        <li>In lookup table: one derived dimension will be auto generated for all the selected columns.</li>
-                                    </ol>
-                                </div>
-                            </div>
+
                         </div>
                     </div>
                 </div>
             </div>
         </div>
         <div class="modal-footer">
-            <button class="btn btn-primary" ng-disabled="" ng-click="ok()">OK</button>
+            <button class="btn btn-primary" ng-disabled="" ng-click="checkAutoDimension()?ok():''">OK</button>
             <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
         </div>
     </script>
     </ng-form>
 </div>
+<script type="text/ng-template" id="AutoDimensionsTip.html">
+  <div class="row">
+    <div class="col-xs-12">
+      <ol class="text-info">
+        <li>Column is disabled once there is already a dimension referred this column.</li>
+        <li>In fact table: one normal dimension will be auto generated per column.</li>
+        <li>In lookup table: one derived dimension will be auto generated for all the selected columns.</li>
+      </ol>
+    </div>
+  </div>
+</script>


[3/5] kylin git commit: fix mvn test

Posted by li...@apache.org.
fix mvn test


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

Branch: refs/heads/KYLIN-1971
Commit: 89b8e14b79824c118cf248ed2be4987845909718
Parents: 2814f61
Author: Li Yang <li...@apache.org>
Authored: Mon Oct 24 15:14:31 2016 +0800
Committer: Li Yang <li...@apache.org>
Committed: Mon Oct 24 15:39:33 2016 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/metadata/model/TblColRef.java | 10 ++++++----
 .../kylin/storage/gtrecord/DictGridTableTest.java  | 17 ++++++++---------
 2 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/89b8e14b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
index b955f47..69569dd 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
@@ -192,11 +192,13 @@ public class TblColRef implements Serializable {
 
     @Override
     public String toString() {
-        String alias = table == null ? "UNKNOWN-MODEL" : table.getAlias();
-        if (alias.equals(column.getTable().getName())) {
-            return column.getTable().getIdentity() + "." + column.getName();
+        String alias = table == null ? "UNKNOWN_MODEL" : table.getAlias();
+        String tableName = column.getTable() == null ? "NULL" : column.getTable().getName();
+        String tableIdentity = column.getTable() == null ? "NULL" : column.getTable().getIdentity();
+        if (alias.equals(tableName)) {
+            return tableIdentity + "." + column.getName();
         } else {
-            return alias + ":" + column.getTable().getIdentity() + "." + column.getName();
+            return alias + ":" + tableIdentity + "." + column.getName();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/89b8e14b/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java
----------------------------------------------------------------------
diff --git a/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java b/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java
index d40eb08..bac9c10 100644
--- a/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java
+++ b/core-storage/src/test/java/org/apache/kylin/storage/gtrecord/DictGridTableTest.java
@@ -40,7 +40,9 @@ import org.apache.kylin.dict.TrieDictionaryBuilder;
 import org.apache.kylin.dimension.DictionaryDimEnc;
 import org.apache.kylin.dimension.DimensionEncoding;
 import org.apache.kylin.gridtable.GTBuilder;
+import org.apache.kylin.gridtable.GTFilterScanner.FilterResultCache;
 import org.apache.kylin.gridtable.GTInfo;
+import org.apache.kylin.gridtable.GTInfo.Builder;
 import org.apache.kylin.gridtable.GTRecord;
 import org.apache.kylin.gridtable.GTScanRange;
 import org.apache.kylin.gridtable.GTScanRequest;
@@ -48,8 +50,6 @@ import org.apache.kylin.gridtable.GTScanRequestBuilder;
 import org.apache.kylin.gridtable.GTUtil;
 import org.apache.kylin.gridtable.GridTable;
 import org.apache.kylin.gridtable.IGTScanner;
-import org.apache.kylin.gridtable.GTFilterScanner.FilterResultCache;
-import org.apache.kylin.gridtable.GTInfo.Builder;
 import org.apache.kylin.gridtable.memstore.GTSimpleMemStore;
 import org.apache.kylin.metadata.datatype.DataType;
 import org.apache.kylin.metadata.datatype.LongMutable;
@@ -60,7 +60,6 @@ import org.apache.kylin.metadata.filter.ExtractTupleFilter;
 import org.apache.kylin.metadata.filter.LogicalTupleFilter;
 import org.apache.kylin.metadata.filter.TupleFilter;
 import org.apache.kylin.metadata.filter.TupleFilter.FilterOperatorEnum;
-import org.apache.kylin.metadata.model.ColumnDesc;
 import org.apache.kylin.metadata.model.TableDesc;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.junit.After;
@@ -302,7 +301,7 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
         GTScanRequest req = new GTScanRequestBuilder().setInfo(info).setRanges(null).setDimensions(null).setAggrGroupBy(setOf(0)).setAggrMetrics(setOf(3)).setAggrMetricsFuncs(new String[] { "sum" }).setFilterPushDown(filter).createGTScanRequest();
 
         // note the unEvaluatable column 1 in filter is added to group by
-        assertEquals("GTScanRequest [range=[[null, null]-[null, null]], columns={0, 1, 3}, filterPushDown=AND [NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], [null], [null]], aggrGroupBy={0, 1}, aggrMetrics={3}, aggrMetricsFuncs=[sum]]", req.toString());
+        assertEquals("GTScanRequest [range=[[null, null]-[null, null]], columns={0, 1, 3}, filterPushDown=AND [UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], [null], [null]], aggrGroupBy={0, 1}, aggrMetrics={3}, aggrMetricsFuncs=[sum]]", req.toString());
 
         doScanAndVerify(table, useDeserializedGTScanRequest(req), "[1421280000000, 20, null, 20, null]", "[1421280000000, 30, null, 10, null]", "[1421366400000, 20, null, 20, null]", "[1421366400000, 30, null, 20, null]", "[1421452800000, 10, null, 10, null]");
     }
@@ -317,7 +316,7 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
 
         GTScanRequest req = new GTScanRequestBuilder().setInfo(info).setRanges(null).setDimensions(null).setAggrGroupBy(setOf(0)).setAggrMetrics(setOf(3)).setAggrMetricsFuncs(new String[] { "sum" }).setFilterPushDown(filter).createGTScanRequest();
         // note the evaluatable column 1 in filter is added to returned columns but not in group by
-        assertEquals("GTScanRequest [range=[[null, null]-[null, null]], columns={0, 1, 3}, filterPushDown=AND [NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], NULL.GT_MOCKUP_TABLE.1 GT [\\x00]], aggrGroupBy={0}, aggrMetrics={3}, aggrMetricsFuncs=[sum]]", req.toString());
+        assertEquals("GTScanRequest [range=[[null, null]-[null, null]], columns={0, 1, 3}, filterPushDown=AND [UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.1 GT [\\x00]], aggrGroupBy={0}, aggrMetrics={3}, aggrMetricsFuncs=[sum]]", req.toString());
 
         doScanAndVerify(table, useDeserializedGTScanRequest(req), "[1421280000000, 20, null, 30, null]", "[1421366400000, 20, null, 40, null]");
     }
@@ -372,7 +371,7 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
         colMapping.add(extColB);
 
         TupleFilter newFilter = GTUtil.convertFilterColumnsAndConstants(filter, info, colMapping, null);
-        assertEquals("AND [NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], NULL.GT_MOCKUP_TABLE.1 EQ [\\x00]]", newFilter.toString());
+        assertEquals("AND [UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.1 EQ [\\x00]]", newFilter.toString());
     }
 
     @Test
@@ -393,7 +392,7 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
 
         // $1<"9" round up to $1<"10"
         TupleFilter newFilter = GTUtil.convertFilterColumnsAndConstants(filter, info, colMapping, null);
-        assertEquals("AND [NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], NULL.GT_MOCKUP_TABLE.1 LT [\\x00]]", newFilter.toString());
+        assertEquals("AND [UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.1 LT [\\x00]]", newFilter.toString());
     }
 
     @Test
@@ -414,7 +413,7 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
 
         // $1<="9" round down to FALSE
         TupleFilter newFilter = GTUtil.convertFilterColumnsAndConstants(filter, info, colMapping, null);
-        assertEquals("AND [NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], []]", newFilter.toString());
+        assertEquals("AND [UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], []]", newFilter.toString());
     }
 
     @Test
@@ -435,7 +434,7 @@ public class DictGridTableTest extends LocalFileMetadataTestCase {
 
         // $1 in ("9", "10", "15") has only "10" left
         TupleFilter newFilter = GTUtil.convertFilterColumnsAndConstants(filter, info, colMapping, null);
-        assertEquals("AND [NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], NULL.GT_MOCKUP_TABLE.1 IN [\\x00]]", newFilter.toString());
+        assertEquals("AND [UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.0 GT [\\x00\\x00\\x01J\\xE5\\xBD\\x5C\\x00], UNKNOWN_MODEL:NULL.GT_MOCKUP_TABLE.1 IN [\\x00]]", newFilter.toString());
     }
 
     private void doScanAndVerify(GridTable table, GTScanRequest req, String... verifyRows) throws IOException {


[5/5] kylin git commit: remove TblColRef.isSameAs()

Posted by li...@apache.org.
remove TblColRef.isSameAs()


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

Branch: refs/heads/KYLIN-1971
Commit: 9b4209bedfb76eb770a22dd5a86fa7874500b38a
Parents: 5c23699
Author: Yang Li <li...@apache.org>
Authored: Tue Oct 25 06:16:15 2016 +0800
Committer: Yang Li <li...@apache.org>
Committed: Tue Oct 25 06:16:15 2016 +0800

----------------------------------------------------------------------
 .../apache/kylin/metadata/model/ColumnDesc.java |  8 +-----
 .../kylin/metadata/model/FunctionDesc.java      | 18 -------------
 .../apache/kylin/metadata/model/TableRef.java   |  4 +--
 .../apache/kylin/metadata/model/TblColRef.java  | 16 ++++-------
 .../apache/kylin/query/ITKylinQueryTest.java    |  4 +--
 .../kylin/query/routing/ModelChooser.java       | 28 ++++++++++++++++++++
 6 files changed, 38 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/9b4209be/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
index 772297f..3bf0de9 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
@@ -20,12 +20,11 @@ package org.apache.kylin.metadata.model;
 
 import java.io.Serializable;
 
-import com.fasterxml.jackson.annotation.JsonInclude;
-import org.apache.commons.lang.StringUtils;
 import org.apache.kylin.metadata.datatype.DataType;
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
 import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 /**
@@ -154,11 +153,6 @@ public class ColumnDesc implements Serializable {
         }
     }
 
-    public boolean isSameAs(String tableName, String columnName) {
-        return StringUtils.equalsIgnoreCase(table.getIdentity(), tableName) && //
-                StringUtils.equalsIgnoreCase(name, columnName);
-    }
-
     @Override
     public int hashCode() {
         final int prime = 31;

http://git-wip-us.apache.org/repos/asf/kylin/blob/9b4209be/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java
index a2c5756..e7d5186 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/FunctionDesc.java
@@ -19,7 +19,6 @@
 package org.apache.kylin.metadata.model;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Set;
@@ -238,23 +237,6 @@ public class FunctionDesc {
         this.returnDataType = DataType.getType(returnType);
     }
 
-    public TblColRef selectTblColRef(Collection<TblColRef> metricColumns, String factTableName) {
-        if (this.isCount())
-            return null; // count is not about any column but the whole row
-
-        ParameterDesc parameter = this.getParameter();
-        if (parameter == null)
-            return null;
-
-        String columnName = parameter.getValue();
-        for (TblColRef col : metricColumns) {
-            if (col.isSameAs(factTableName, columnName)) {
-                return col;
-            }
-        }
-        return null;
-    }
-
     public HashMap<String, String> getConfiguration() {
         return configuration;
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/9b4209be/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java
index 186ff35..254ce18 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableRef.java
@@ -86,9 +86,9 @@ public class TableRef {
 
         TableRef t = (TableRef) o;
 
-        if (!model.equals(t.model))
+        if ((model == null ? t.model == null : model.getName().equals(t.model.getName())) == false)
             return false;
-        if (!alias.equals(t.alias))
+        if ((alias == null ? t.alias == null : alias.equals(t.alias)) == false)
             return false;
         if (!table.getIdentity().equals(t.table.getIdentity()))
             return false;

http://git-wip-us.apache.org/repos/asf/kylin/blob/9b4209be/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
index 69569dd..79cd961 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
@@ -64,6 +64,9 @@ public class TblColRef implements Serializable {
     }
     
     private static final DataModelDesc UNKNOWN_MODEL = new DataModelDesc();
+    static {
+        UNKNOWN_MODEL.setName("UNKNOWN_MODEL");
+    }
     
     public static TableRef tableForUnknownModel(String tempTableAlias, TableDesc table) {
         return new TableRef(UNKNOWN_MODEL, tempTableAlias, table);
@@ -152,17 +155,6 @@ public class TblColRef implements Serializable {
         return InnerDataTypeEnum.DERIVED.getDataType().equals(getDatatype());
     }
 
-    /**
-     *
-     * @param tableName full name : db.table
-     * @param columnName columnname
-     * @return
-     */
-    public boolean isSameAs(String tableName, String columnName) {
-        return column.isSameAs(tableName, columnName);
-    }
-
-    @Override
     public int hashCode() {
         // NOTE: tableRef MUST NOT participate in hashCode().
         // Because fixUnknownModel() can change tableRef while TblColRef is held as set/map keys.
@@ -187,6 +179,8 @@ public class TblColRef implements Serializable {
             return false;
         if (!StringUtils.equals(column.getName(), other.column.getName()))
             return false;
+//        if ((table == null ? other.table == null : table.equals(other.table)) == false)
+//            return false;
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/9b4209be/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java b/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
index 2ec5324..f9fbffb 100644
--- a/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
@@ -45,7 +45,7 @@ import org.junit.rules.ExpectedException;
 
 import com.google.common.collect.Maps;
 
-@Ignore("KylinQueryTest is contained by ITCombinationTest")
+//@Ignore("KylinQueryTest is contained by ITCombinationTest")
 public class ITKylinQueryTest extends KylinTestBase {
 
     @Rule
@@ -150,7 +150,7 @@ public class ITKylinQueryTest extends KylinTestBase {
 
     }
 
-    @Ignore
+    //@Ignore
     @Test
     public void testSingleRunQuery() throws Exception {
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/9b4209be/query/src/main/java/org/apache/kylin/query/routing/ModelChooser.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/routing/ModelChooser.java b/query/src/main/java/org/apache/kylin/query/routing/ModelChooser.java
new file mode 100644
index 0000000..623866b
--- /dev/null
+++ b/query/src/main/java/org/apache/kylin/query/routing/ModelChooser.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.query.routing;
+
+import org.apache.kylin.query.relnode.OLAPContext;
+
+public class ModelChooser {
+
+    public static void chooseModel(OLAPContext context) {
+        
+    }
+}


[2/5] kylin git commit: KYLIN-1321 auto generate style update

Posted by li...@apache.org.
KYLIN-1321 auto generate style update


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

Branch: refs/heads/KYLIN-1971
Commit: 2814f612a4530434cca3f958878dfa761bb95aa5
Parents: 5a44868
Author: Jason <ji...@163.com>
Authored: Mon Oct 24 14:54:53 2016 +0800
Committer: Jason <ji...@163.com>
Committed: Mon Oct 24 14:54:53 2016 +0800

----------------------------------------------------------------------
 webapp/app/less/component.less                   | 4 ++++
 webapp/app/partials/cubeDesigner/dimensions.html | 4 ++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/2814f612/webapp/app/less/component.less
----------------------------------------------------------------------
diff --git a/webapp/app/less/component.less b/webapp/app/less/component.less
index 1102b49..d99ddbb 100644
--- a/webapp/app/less/component.less
+++ b/webapp/app/less/component.less
@@ -1192,3 +1192,7 @@ ul.abn-tree li.abn-tree-row a {
 .floatR{
   float: right;
 }
+
+.dim-checkbox-label{
+  width: 100%;
+}

http://git-wip-us.apache.org/repos/asf/kylin/blob/2814f612/webapp/app/partials/cubeDesigner/dimensions.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/dimensions.html b/webapp/app/partials/cubeDesigner/dimensions.html
index 4d48167..3a2efb6 100644
--- a/webapp/app/partials/cubeDesigner/dimensions.html
+++ b/webapp/app/partials/cubeDesigner/dimensions.html
@@ -245,8 +245,10 @@
                                   </tr>
                                   <tr ng-repeat="col in availableColumns[table] track by col.table + '.' + col.name" >
                                     <td >
+                                      <label class="dim-checkbox-label">
                                       <input type="checkbox" ng-model="selectedColumns[table][col.name].selected"
                                              ng-disabled="selectedColumns[table][col.name].disabled"  >
+                                      </label>
                                     </td>
                                     <td >
                                       <input type="text"  placeholder={{col.name}} ng-model="selectedColumns[table][col.name].name" ng-disabled="!selectedColumns[table][col.name].selected" style="width:90%;">
@@ -268,8 +270,10 @@
                                   </tr>
                                   <tr ng-repeat="col in availableColumns[table] track by col.table + '.' + col.name" class="row">
                                     <td class=>
+                                      <label class="dim-checkbox-label">
                                       <input type="checkbox" ng-model="selectedColumns[table][col.name].selected"
                                              ng-disabled="selectedColumns[table][col.name].disabled"  ng-change="autoChange(table,col.name)">
+                                      </label>
                                     </td>
                                     <td >
                                       <input type="text" ng-model="selectedColumns[table][col.name].name" placeholder={{table}}_derived  ng-disabled="!selectedColumns[table][col.name].selected" style="width:90%;">


[4/5] kylin git commit: KYLIN-2070 UI changes for allowing concurrent build/refresh/merge done

Posted by li...@apache.org.
KYLIN-2070 UI changes for allowing concurrent build/refresh/merge done

Signed-off-by: Jason <ji...@163.com>


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

Branch: refs/heads/KYLIN-1971
Commit: 5c23699533f3d5c32cb34371a5d6c8da661bcd71
Parents: 89b8e14
Author: luguosheng <55...@qq.com>
Authored: Mon Oct 24 11:34:01 2016 +0800
Committer: Jason <ji...@163.com>
Committed: Mon Oct 24 15:42:10 2016 +0800

----------------------------------------------------------------------
 webapp/app/partials/cubes/cube_detail.html | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/5c236995/webapp/app/partials/cubes/cube_detail.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubes/cube_detail.html b/webapp/app/partials/cubes/cube_detail.html
index 38802ef..909e05e 100755
--- a/webapp/app/partials/cubes/cube_detail.html
+++ b/webapp/app/partials/cubes/cube_detail.html
@@ -98,6 +98,11 @@
             <div ng-repeat="table in cube.hbase">
                 <h5><b>HTable:</b> {{table.tableName}}</h5>
                 <ul>
+                    <li ng-if="cube.streaming">Segment Name: <span class="red">{{table.segmentName}}</span></li>
+                    <li ng-if="cube.streaming">Segment Status: <span class="red">{{table.segmentStatus}}</span></li>
+                    <li ng-if="cube.streaming">Source Count: <span class="red">{{table.sourceCount}}</span></li>
+                    <li ng-if="cube.streaming&&table.sourceOffsetStart>0">SourceOffsetStart: <span class="red">{{table.sourceOffsetStart|reverseToGMT0}}</span></li>
+                    <li ng-if="cube.streaming&&table.sourceOffsetEnd>0">SourceOffsetEnd: <span class="red">{{table.sourceOffsetEnd|reverseToGMT0}}</span></li>
                     <li>Region Count: <span class="red">{{table.regionCount}}</span></li>
                     <li>Size: <span class="red">{{table.tableSize | bytes}}</span></li>
                     <li>Start Time: <span class="red">{{table.dateRangeStart | reverseToGMT0}}</span></li>