You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2016/10/25 05:03:40 UTC

[1/2] kylin git commit: KYLIN-2078 Can't see generated SQL at Web UI

Repository: kylin
Updated Branches:
  refs/heads/v1.6.0-rc1 [created] f708274db


KYLIN-2078 Can't see generated SQL at Web UI

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

Branch: refs/heads/v1.6.0-rc1
Commit: 9acc20e46c9cf83e65edc21d0d8cdf037894209d
Parents: eb39437
Author: shaofengshi <sh...@apache.org>
Authored: Tue Oct 25 12:57:46 2016 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Tue Oct 25 12:57:46 2016 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/job/JoinedFlatTable.java     | 18 ++++++++++--------
 .../kylin/rest/controller/CubeController.java     | 16 ++++++++++------
 2 files changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/9acc20e4/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java
----------------------------------------------------------------------
diff --git a/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java b/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java
index 3cc27ba..79cf924 100644
--- a/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java
+++ b/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java
@@ -128,15 +128,17 @@ public class JoinedFlatTable {
             sql.append(tableAlias + "." + col.getName() + "\n");
         }
         appendJoinStatement(flatDesc, sql, tableAliasMap);
-        appendWhereStatement(flatDesc, sql, tableAliasMap);
-        if (redistribute == true) {
-            String redistributeCol = null;
-            TblColRef distDcol = flatDesc.getDistributedBy();
-            if (distDcol != null) {
-                String tblAlias = tableAliasMap.get(distDcol.getTable());
-                redistributeCol = tblAlias + "." + distDcol.getName();
+        if (flatDesc.getSegment() != null) {
+            appendWhereStatement(flatDesc, sql, tableAliasMap);
+            if (redistribute == true) {
+                String redistributeCol = null;
+                TblColRef distDcol = flatDesc.getDistributedBy();
+                if (distDcol != null) {
+                    String tblAlias = tableAliasMap.get(distDcol.getTable());
+                    redistributeCol = tblAlias + "." + distDcol.getName();
+                }
+                appendDistributeStatement(sql, redistributeCol);
             }
-            appendDistributeStatement(sql, redistributeCol);
         }
         return sql.toString();
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/9acc20e4/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java b/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
index c70b506..f78f439 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
@@ -27,7 +27,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
-import com.google.common.collect.Lists;
 import org.apache.commons.lang.StringUtils;
 import org.apache.kylin.common.util.JsonUtil;
 import org.apache.kylin.cube.CubeInstance;
@@ -35,13 +34,13 @@ import org.apache.kylin.cube.CubeManager;
 import org.apache.kylin.cube.CubeSegment;
 import org.apache.kylin.cube.model.CubeBuildTypeEnum;
 import org.apache.kylin.cube.model.CubeDesc;
+import org.apache.kylin.cube.model.CubeJoinedFlatTableDesc;
 import org.apache.kylin.dimension.DimensionEncodingFactory;
 import org.apache.kylin.engine.EngineFactory;
 import org.apache.kylin.job.JobInstance;
 import org.apache.kylin.job.JoinedFlatTable;
 import org.apache.kylin.metadata.model.IJoinedFlatTableDesc;
 import org.apache.kylin.metadata.model.ISourceAware;
-import org.apache.kylin.metadata.model.SegmentStatusEnum;
 import org.apache.kylin.metadata.project.ProjectInstance;
 import org.apache.kylin.metadata.realization.RealizationStatusEnum;
 import org.apache.kylin.rest.exception.BadRequestException;
@@ -74,6 +73,7 @@ import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.google.common.base.Joiner;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 /**
@@ -144,10 +144,15 @@ public class CubeController extends BasicController {
     @ResponseBody
     public GeneralResponse getSql(@PathVariable String cubeName, @PathVariable String segmentName) {
         CubeInstance cube = cubeService.getCubeManager().getCube(cubeName);
-        CubeSegment cubeSegment = cube.getSegment(segmentName, SegmentStatusEnum.READY);
-        IJoinedFlatTableDesc flatTableDesc = EngineFactory.getJoinedFlatTableDesc(cubeSegment);
-        String sql = JoinedFlatTable.generateSelectDataStatement(flatTableDesc, false);
+        IJoinedFlatTableDesc flatTableDesc = null;
+        CubeSegment segment = cube.getSegment(segmentName, null);
+        if (segment != null) {
+            flatTableDesc = EngineFactory.getJoinedFlatTableDesc(segment);
+        } else {
+            flatTableDesc = new CubeJoinedFlatTableDesc(cube.getDescriptor());
+        }
 
+        String sql = JoinedFlatTable.generateSelectDataStatement(flatTableDesc, false);
         GeneralResponse repsonse = new GeneralResponse();
         repsonse.setProperty("sql", sql);
 
@@ -611,7 +616,6 @@ public class CubeController extends BasicController {
 
     }
 
-
     /**
      * Initiate the very beginning of a streaming cube. Will seek the latest offests of each partition from streaming
      * source (kafka) and record in the cube descriptor; In the first build job, it will use these offests as the start point.


[2/2] kylin git commit: KYLIN-2070 minor change in the ‘storage’ tab

Posted by sh...@apache.org.
KYLIN-2070 minor change in the \u2018storage\u2019 tab

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

Branch: refs/heads/v1.6.0-rc1
Commit: f708274dbc920e17e5c9d509bf62d615db855936
Parents: 9acc20e
Author: shaofengshi <sh...@apache.org>
Authored: Tue Oct 25 13:03:12 2016 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Tue Oct 25 13:03:12 2016 +0800

----------------------------------------------------------------------
 webapp/app/partials/cubes/cube_detail.html | 27 +++++++++++--------------
 1 file changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/f708274d/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 909e05e..1896b42 100755
--- a/webapp/app/partials/cubes/cube_detail.html
+++ b/webapp/app/partials/cubes/cube_detail.html
@@ -38,7 +38,7 @@
         </li>
         <li class="{{cube.visiblePage=='hbase'? 'active':''}}"
             ng-if="userService.hasRole('ROLE_ADMIN')">
-            <a href="" ng-click="cube.visiblePage='hbase';getHbaseInfo(cube)">HBase</a>
+            <a href="" ng-click="cube.visiblePage='hbase';getHbaseInfo(cube)">Storage</a>
         </li>
     </ul>
 
@@ -95,27 +95,24 @@
 
   <div class="cube-detail" ng-show="cube.visiblePage=='hbase'">
         <div style="margin: 15px;">
+            <div ng-if="cube.hbase">
+              <div class="hr hr8 hr-double hr-dotted"></div>
+              <h5><b>Segment Number:</b> <span class="red">{{cube.hbase.length}}</span> <b>Total Size:</b> <span class="red">{{cube.totalSize | bytes}}</span></h5>
+            </div>
             <div ng-repeat="table in cube.hbase">
-                <h5><b>HTable:</b> {{table.tableName}}</h5>
+                <h5><b>Segment:</b> {{table.segmentName}}</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 ng-if="cube.streaming">Status: <span class="red">{{table.segmentStatus}}</span></li>
                     <li>Start Time: <span class="red">{{table.dateRangeStart | reverseToGMT0}}</span></li>
                     <li>End Time: <span class="red">{{table.dateRangeEnd | reverseToGMT0}}</span></li>
+                    <li>Source Count: <span class="red">{{table.sourceCount}}</span></li>
+                    <li>HBase Table: <span class="red">{{table.tableName}}</span></li>
+                    <li>Region Count: <span class="red">{{table.regionCount}}</span></li>
+                    <li>Size: <span class="red">{{table.tableSize | bytes}}</span></li>
                 </ul>
             </div>
-            <div ng-if="cube.hbase">
-                <div class="hr hr8 hr-double hr-dotted"></div>
-                <h5><b>Total Size:</b> <span class="red">{{cube.totalSize | bytes}}</span></h5>
-                <h5><b>Total Number:</b> <span class="red">{{cube.hbase.length}}</span></h5>
-            </div>
             <div ng-if="cube.hbase.length == 0">
-                <h5>No HBase Info.</h5>
+                <h5>No Storage Info.</h5>
             </div>
         </div>
     </div>