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 2017/10/18 09:32:49 UTC

[01/10] kylin git commit: Merge commit 'b0dfc049c1b4cd39d943de0a7a8760ba3d6fdfab'

Repository: kylin
Updated Branches:
  refs/heads/2.2.x d25ac5d00 -> 53cad89b3


Merge commit 'b0dfc049c1b4cd39d943de0a7a8760ba3d6fdfab'


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

Branch: refs/heads/2.2.x
Commit: cd9d36a646ec84d175320986f94e1cad18b1aa75
Parents: 622bafe b0dfc04
Author: lidongsjtu <li...@apache.org>
Authored: Thu Oct 12 20:19:20 2017 +0800
Committer: lidongsjtu <li...@apache.org>
Committed: Thu Oct 12 22:20:25 2017 +0800

----------------------------------------------------------------------
 build/script/download-tomcat.sh                 |  4 +--
 .../org/apache/kylin/common/KylinVersion.java   |  2 +-
 .../main/resources/kylin-defaults.properties    |  2 +-
 .../kylin/cube/gridtable/RecordComparators.java | 18 +++++++++++---
 .../storage/gtrecord/DictGridTableTest.java     |  8 ++++++
 .../algorithm/ITGeneticAlgorithmTest.java       |  2 +-
 pom.xml                                         |  2 +-
 webapp/app/js/controllers/access.js             | 10 ++++----
 webapp/app/js/controllers/streamingConfig.js    |  8 +++---
 webapp/app/js/listeners.js                      |  8 +++---
 webapp/app/partials/common/access.html          |  8 +++---
 webapp/app/partials/cubes/cube_detail.html      | 26 ++++++++++----------
 12 files changed, 59 insertions(+), 39 deletions(-)
----------------------------------------------------------------------



[03/10] kylin git commit: minor, add project to cube list api

Posted by li...@apache.org.
minor, add project to cube list api


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

Branch: refs/heads/2.2.x
Commit: 9a51ed87074e996574d2d05b39044371198f4d91
Parents: d20e1d0
Author: lidongsjtu <li...@apache.org>
Authored: Tue Oct 17 15:21:55 2017 +0800
Committer: lidongsjtu <li...@apache.org>
Committed: Tue Oct 17 15:38:05 2017 +0800

----------------------------------------------------------------------
 .../kylin/rest/controller/CubeController.java   | 28 +++++++++++++-------
 .../apache/kylin/rest/service/CubeService.java  | 27 ++++++++++++++++++-
 .../rest/controller/AccessControllerTest.java   | 23 +++++++++-------
 .../rest/controller/CubeControllerTest.java     | 10 +++----
 4 files changed, 62 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/9a51ed87/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 b6ec0e2..c3b6e45 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
@@ -52,6 +52,7 @@ import org.apache.kylin.rest.exception.NotFoundException;
 import org.apache.kylin.rest.request.CubeRequest;
 import org.apache.kylin.rest.request.JobBuildRequest;
 import org.apache.kylin.rest.request.JobBuildRequest2;
+import org.apache.kylin.rest.response.CubeInstanceResponse;
 import org.apache.kylin.rest.response.EnvelopeResponse;
 import org.apache.kylin.rest.response.GeneralResponse;
 import org.apache.kylin.rest.response.HBaseResponse;
@@ -109,26 +110,34 @@ public class CubeController extends BasicController {
 
     @RequestMapping(value = "", method = { RequestMethod.GET }, produces = { "application/json" })
     @ResponseBody
-    public List<CubeInstance> getCubes(@RequestParam(value = "cubeName", required = false) String cubeName,
+    public List<CubeInstanceResponse> getCubes(@RequestParam(value = "cubeName", required = false) String cubeName,
             @RequestParam(value = "modelName", required = false) String modelName,
             @RequestParam(value = "projectName", required = false) String projectName,
             @RequestParam(value = "limit", required = false) Integer limit,
             @RequestParam(value = "offset", required = false) Integer offset) {
-        List<CubeInstance> cubes;
-        cubes = cubeService.listAllCubes(cubeName, projectName, modelName, true);
+        List<CubeInstance> cubes = cubeService.listAllCubes(cubeName, projectName, modelName, true);
 
-        int climit = (null == limit) ? cubes.size() : limit;
+        List<CubeInstanceResponse> response = Lists.newArrayListWithExpectedSize(cubes.size());
+        for (CubeInstance cube : cubes) {
+            try {
+                response.add(cubeService.createCubeInstanceResponse(cube));
+            } catch (Exception e) {
+                logger.error("Error creating cube instance response, skipping.", e);
+            }
+        }
+
+        int climit = (null == limit) ? response.size() : limit;
         int coffset = (null == offset) ? 0 : offset;
 
-        if (cubes.size() <= coffset) {
+        if (response.size() <= coffset) {
             return Collections.emptyList();
         }
 
-        if ((cubes.size() - coffset) < climit) {
-            return cubes.subList(coffset, cubes.size());
+        if ((response.size() - coffset) < climit) {
+            return response.subList(coffset, response.size());
         }
 
-        return cubes.subList(coffset, coffset + climit);
+        return response.subList(coffset, coffset + climit);
     }
 
     @RequestMapping(value = "validEncodings", method = { RequestMethod.GET }, produces = { "application/json" })
@@ -280,7 +289,7 @@ public class CubeController extends BasicController {
     @RequestMapping(value = "/{cubeName}/rebuild", method = { RequestMethod.PUT }, produces = { "application/json" })
     @ResponseBody
     public JobInstance rebuild(@PathVariable String cubeName, @RequestBody JobBuildRequest req) {
-        return buildInternal(cubeName, new TSRange(req.getStartTime(), req.getEndTime()), null, null, null, 
+        return buildInternal(cubeName, new TSRange(req.getStartTime(), req.getEndTime()), null, null, null,
                 req.getBuildType(), req.isForce() || req.isForceMergeEmptySegment());
     }
 
@@ -746,5 +755,4 @@ public class CubeController extends BasicController {
     public void setJobService(JobService jobService) {
         this.jobService = jobService;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/9a51ed87/server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java b/server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java
index 28859b6..299540f 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java
@@ -42,6 +42,7 @@ import org.apache.kylin.job.execution.ExecutableState;
 import org.apache.kylin.metadata.cachesync.Broadcaster;
 import org.apache.kylin.metadata.draft.Draft;
 import org.apache.kylin.metadata.model.DataModelDesc;
+import org.apache.kylin.metadata.model.ISourceAware;
 import org.apache.kylin.metadata.model.SegmentRange;
 import org.apache.kylin.metadata.model.SegmentStatusEnum;
 import org.apache.kylin.metadata.project.ProjectInstance;
@@ -55,6 +56,7 @@ import org.apache.kylin.rest.exception.ForbiddenException;
 import org.apache.kylin.rest.msg.Message;
 import org.apache.kylin.rest.msg.MsgPicker;
 import org.apache.kylin.rest.request.MetricsRequest;
+import org.apache.kylin.rest.response.CubeInstanceResponse;
 import org.apache.kylin.rest.response.HBaseResponse;
 import org.apache.kylin.rest.response.MetricsResponse;
 import org.apache.kylin.rest.security.AclPermission;
@@ -69,6 +71,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.stereotype.Component;
 
+import com.google.common.base.Preconditions;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.collect.Lists;
@@ -446,7 +449,7 @@ public class CubeService extends BasicService implements InitializingBean {
         if ("hbase".equals(getConfig().getMetadataUrl().getScheme())) {
             try {
                 logger.debug("Loading HTable info " + cubeName + ", " + tableName);
-                
+
                 // use reflection to isolate NoClassDef errors when HBase is not available
                 hr = (HBaseResponse) Class.forName("org.apache.kylin.rest.service.HBaseInfoUtil")//
                         .getMethod("getHBaseInfo", new Class[] { String.class, KylinConfig.class })//
@@ -460,6 +463,28 @@ public class CubeService extends BasicService implements InitializingBean {
         return hr;
     }
 
+    public CubeInstanceResponse createCubeInstanceResponse(CubeInstance cube) {
+        Preconditions.checkState(!cube.getDescriptor().isDraft());
+
+        CubeInstanceResponse r = new CubeInstanceResponse(cube);
+
+        CubeDesc cubeDesc = cube.getDescriptor();
+        DataModelDesc modelDesc = cubeDesc.getModel();
+        r.setModel(cubeDesc.getModelName());
+        r.setLastModified(cubeDesc.getLastModified());
+        r.setPartitionDateStart(cubeDesc.getPartitionDateStart());
+        // cuz model doesn't have a state the label a model is broken,
+        // so in some case the model can not be loaded due to some check failed,
+        // but the cube in this model can still be loaded.
+        if (modelDesc != null) {
+            r.setPartitionDateColumn(modelDesc.getPartitionDesc().getPartitionDateColumn());
+            r.setIs_streaming(modelDesc.getRootFactTable().getTableDesc().getSourceType() == ISourceAware.ID_STREAMING);
+        }
+        r.setProject(cube.getProject());
+
+        return r;
+    }
+
     public void updateCubeNotifyList(CubeInstance cube, List<String> notifyList) throws IOException {
         aclEvaluate.hasProjectOperationPermission(cube.getProjectInstance());
         CubeDesc desc = cube.getDescriptor();

http://git-wip-us.apache.org/repos/asf/kylin/blob/9a51ed87/server/src/test/java/org/apache/kylin/rest/controller/AccessControllerTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/controller/AccessControllerTest.java b/server/src/test/java/org/apache/kylin/rest/controller/AccessControllerTest.java
index 1040a84..076c080 100644
--- a/server/src/test/java/org/apache/kylin/rest/controller/AccessControllerTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/controller/AccessControllerTest.java
@@ -18,10 +18,18 @@
 
 package org.apache.kylin.rest.controller;
 
+import static junit.framework.TestCase.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.List;
+
 import org.apache.kylin.cube.CubeInstance;
 import org.apache.kylin.metadata.project.ProjectInstance;
 import org.apache.kylin.rest.request.AccessRequest;
 import org.apache.kylin.rest.response.AccessEntryResponse;
+import org.apache.kylin.rest.response.CubeInstanceResponse;
 import org.apache.kylin.rest.security.AclEntityType;
 import org.apache.kylin.rest.security.AclPermissionType;
 import org.apache.kylin.rest.service.AccessService;
@@ -38,13 +46,6 @@ import org.springframework.security.authentication.TestingAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 
-import java.io.IOException;
-import java.util.List;
-
-import static junit.framework.TestCase.fail;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 /**
  * @author xduo
  */
@@ -88,7 +89,8 @@ public class AccessControllerTest extends ServiceTestBase implements AclEntityTy
     @Test
     public void testBasics() throws IOException {
         swichToAdmin();
-        List<AccessEntryResponse> aes = accessController.getAccessEntities(CUBE_INSTANCE, "a24ca905-1fc6-4f67-985c-38fa5aeafd92");
+        List<AccessEntryResponse> aes = accessController.getAccessEntities(CUBE_INSTANCE,
+                "a24ca905-1fc6-4f67-985c-38fa5aeafd92");
         Assert.assertTrue(aes.size() == 0);
 
         AccessRequest accessRequest = getAccessRequest(MODELER, ADMINISTRATION);
@@ -151,7 +153,7 @@ public class AccessControllerTest extends ServiceTestBase implements AclEntityTy
     @Test
     public void testAuthInCubeLevel() throws Exception {
         swichToAdmin();
-        List<CubeInstance> cubes = cubeController.getCubes(null, null, null, 100000, 0);
+        List<CubeInstanceResponse> cubes = cubeController.getCubes(null, null, null, 100000, 0);
         assertTrue(cubes.size() > 0);
         CubeInstance cube = cubes.get(0);
         swichToAnalyst();
@@ -173,7 +175,8 @@ public class AccessControllerTest extends ServiceTestBase implements AclEntityTy
         }
         swichToAdmin();
         List<ProjectInstance> projects = projectController.getProjects(10000, 0);
-        List<AccessEntryResponse> aes = accessController.grant(PROJECT_INSTANCE, projects.get(0).getUuid(), accessRequest);
+        List<AccessEntryResponse> aes = accessController.grant(PROJECT_INSTANCE, projects.get(0).getUuid(),
+                accessRequest);
         Assert.assertTrue(aes.size() == 1);
         swichToAnalyst();
         cubes = cubeController.getCubes(null, null, "default", 100000, 0);

http://git-wip-us.apache.org/repos/asf/kylin/blob/9a51ed87/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java b/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
index 2c91d90..950f0b4 100644
--- a/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
@@ -28,6 +28,7 @@ import org.apache.kylin.cube.model.CubeDesc;
 import org.apache.kylin.metadata.model.SegmentRange.TSRange;
 import org.apache.kylin.rest.exception.InternalErrorException;
 import org.apache.kylin.rest.request.CubeRequest;
+import org.apache.kylin.rest.response.CubeInstanceResponse;
 import org.apache.kylin.rest.service.CubeService;
 import org.apache.kylin.rest.service.JobService;
 import org.apache.kylin.rest.service.ServiceTestBase;
@@ -120,7 +121,8 @@ public class CubeControllerTest extends ServiceTestBase {
         cubeController.updateNotifyList(newCubeName, notifyList);
         cubeController.updateCubeCost(newCubeName, 80);
 
-        List<CubeInstance> cubeInstances = cubeController.getCubes(newCubeName, cube.getModelName(), "default", 1, 0);
+        List<CubeInstanceResponse> cubeInstances = cubeController.getCubes(newCubeName, cube.getModelName(), "default",
+                1, 0);
 
         CubeInstance cubeInstance = cubeInstances.get(0);
         Assert.assertTrue(cubeInstance.getDescriptor().getNotifyList().contains("john@example.com"));
@@ -170,7 +172,6 @@ public class CubeControllerTest extends ServiceTestBase {
         Assert.assertTrue(segNumber == newSegNumber + 1);
     }
 
-
     @Test
     public void testGetHoles() throws IOException {
         String cubeName = "test_kylin_cube_with_slr_ready_3_segments";
@@ -180,7 +181,7 @@ public class CubeControllerTest extends ServiceTestBase {
         CubeInstance cube = cubeService.getCubeManager().getCube(cubeName);
         List<CubeSegment> segments = cube.getSegments();
 
-        final long dateEnd = segments.get(segments.size() -1).getTSRange().end.v;
+        final long dateEnd = segments.get(segments.size() - 1).getTSRange().end.v;
 
         final long ONEDAY = 24 * 60 * 60000;
         cubeService.getCubeManager().appendSegment(cube, new TSRange(dateEnd + ONEDAY, dateEnd + ONEDAY * 2));
@@ -194,10 +195,9 @@ public class CubeControllerTest extends ServiceTestBase {
         Assert.assertTrue(hole.getTSRange().equals(new TSRange(dateEnd, dateEnd + ONEDAY)));
     }
 
-
     @Test
     public void testGetCubes() {
-        List<CubeInstance> cubes = cubeController.getCubes(null, null, null, 1, 0);
+        List<CubeInstanceResponse> cubes = cubeController.getCubes(null, null, null, 1, 0);
         Assert.assertTrue(cubes.size() == 1);
     }
 


[02/10] kylin git commit: Hide columns begin with "_KY_" for prepare queries

Posted by li...@apache.org.
Hide columns begin with "_KY_" for prepare queries


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

Branch: refs/heads/2.2.x
Commit: d20e1d079b51bdb3b7e85a670acbab9a5626f980
Parents: cd9d36a
Author: nichunen <ch...@kyligence.io>
Authored: Mon Oct 16 19:45:36 2017 +0800
Committer: nichunen <ch...@kyligence.io>
Committed: Mon Oct 16 19:45:36 2017 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kylin/rest/service/QueryService.java    | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/d20e1d07/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java b/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
index b31fb3b..ddb805c 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
@@ -910,6 +910,10 @@ public class QueryService extends BasicService {
 
                     RelDataTypeField field = fieldList.get(i);
                     String columnName = field.getKey();
+
+                    if (columnName.startsWith("_KY_")) {
+                        continue;
+                    }
                     BasicSqlType basicSqlType = (BasicSqlType) field.getValue();
 
                     columnMetas.add(new SelectedColumnMeta(false, config.caseSensitive(), false, false,


[08/10] kylin git commit: Minor: Fix UT

Posted by li...@apache.org.
Minor: Fix UT

(cherry picked from commit c3390b1ba592eacc06cfde6317594ba4fc8c8462)


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

Branch: refs/heads/2.2.x
Commit: 3ead3c92e2e933711eb91b8870e74e9ece801ba7
Parents: 48a08e5
Author: Yifan Zhang <ev...@gmail.com>
Authored: Tue Oct 10 15:17:39 2017 +0800
Committer: Yifan Zhang <ev...@gmail.com>
Committed: Wed Oct 18 13:15:15 2017 +0800

----------------------------------------------------------------------
 examples/test_case_data/localmeta/kylin.properties | 2 +-
 examples/test_case_data/sandbox/kylin.properties   | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/3ead3c92/examples/test_case_data/localmeta/kylin.properties
----------------------------------------------------------------------
diff --git a/examples/test_case_data/localmeta/kylin.properties b/examples/test_case_data/localmeta/kylin.properties
index c7dda3f..445e2f9 100644
--- a/examples/test_case_data/localmeta/kylin.properties
+++ b/examples/test_case_data/localmeta/kylin.properties
@@ -84,7 +84,7 @@ kylin.engine.mr.uhc-reducer-count=3
 
 ### QUERY ###
 
-kylin.query.transformers=org.apache.kylin.query.util.KeywordDefaultDirtyHack
+kylin.query.transformers=org.apache.kylin.query.util.DefaultQueryTransformer,org.apache.kylin.query.util.KeywordDefaultDirtyHack
 
 ### SECURITY ###
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/3ead3c92/examples/test_case_data/sandbox/kylin.properties
----------------------------------------------------------------------
diff --git a/examples/test_case_data/sandbox/kylin.properties b/examples/test_case_data/sandbox/kylin.properties
index 619bf99..00fea26 100644
--- a/examples/test_case_data/sandbox/kylin.properties
+++ b/examples/test_case_data/sandbox/kylin.properties
@@ -197,3 +197,5 @@ kylin.engine.spark-conf.spark.hadoop.yarn.timeline-service.enabled=false
 #kylin.query.pushdown.jdbc.pool-max-total=8
 #kylin.query.pushdown.jdbc.pool-max-idle=8
 #kylin.query.pushdown.jdbc.pool-min-idle=0
+
+kylin.query.transformers=org.apache.kylin.query.util.DefaultQueryTransformer


[05/10] kylin git commit: kylin access for cube and model (#2782)

Posted by li...@apache.org.
kylin access for cube and model (#2782)



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

Branch: refs/heads/2.2.x
Commit: a794544f9c79f04d44015730bed96c03055b6733
Parents: 32b2400
Author: luguosheng1314 <55...@qq.com>
Authored: Tue Oct 17 04:25:13 2017 -0500
Committer: lidongsjtu <li...@apache.org>
Committed: Tue Oct 17 17:44:05 2017 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeSchema.js     |  5 -----
 webapp/app/js/controllers/modelSchema.js    |  4 ----
 webapp/app/js/controllers/page.js           | 21 +++++++++++++++++----
 webapp/app/partials/common/access.html      | 10 +++++-----
 webapp/app/partials/cubes/cube_detail.html  |  4 ++--
 webapp/app/partials/cubes/cubes.html        |  6 +++---
 webapp/app/partials/models/models_tree.html |  2 +-
 webapp/app/partials/projects/projects.html  |  4 ++--
 8 files changed, 30 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/a794544f/webapp/app/js/controllers/cubeSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
index a912c72..2a47a8c 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -160,11 +160,6 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
 
     });
 
-    // ~ public methods
-    $scope.filterProj = function(project){
-        return $scope.userService.hasRole('ROLE_ADMIN') || $scope.hasPermission(project,$scope.permissions.ADMINISTRATION.mask);
-    };
-
 
     $scope.removeElement = function (arr, element) {
         var index = arr.indexOf(element);

http://git-wip-us.apache.org/repos/asf/kylin/blob/a794544f/webapp/app/js/controllers/modelSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/modelSchema.js b/webapp/app/js/controllers/modelSchema.js
index 41a26bb..d1744bb 100644
--- a/webapp/app/js/controllers/modelSchema.js
+++ b/webapp/app/js/controllers/modelSchema.js
@@ -84,10 +84,6 @@ KylinApp.controller('ModelSchemaCtrl', function ($scope, QueryService, UserServi
 
   });
 
-  // ~ public methods
-  $scope.filterProj = function (project) {
-    return $scope.userService.hasRole('ROLE_ADMIN') || $scope.hasPermission(project, $scope.permissions.ADMINISTRATION.mask);
-  };
 
   $scope.removeElement = function (arr, element) {
     var index = arr.indexOf(element);

http://git-wip-us.apache.org/repos/asf/kylin/blob/a794544f/webapp/app/js/controllers/page.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/page.js b/webapp/app/js/controllers/page.js
index 575f455..5a77195 100644
--- a/webapp/app/js/controllers/page.js
+++ b/webapp/app/js/controllers/page.js
@@ -88,20 +88,33 @@ KylinApp.controller('PageCtrl', function ($scope, $q, AccessService, $modal, $lo
   };
 
   // common acl methods
-  $scope.hasPermission = function (entity) {
+  $scope.hasPermission = function (accessType, entity) {
     var curUser = UserService.getCurUser();
     if (!curUser.userDetails) {
       return curUser;
     }
-
     var hasPermission = false;
     var masks = [];
-    for (var i = 1; i < arguments.length; i++) {
+    for (var i = 2; i < arguments.length; i++) {
       if (arguments[i]) {
         masks.push(arguments[i]);
       }
     }
-
+    var project = ''
+    var projectAccesses = ProjectModel.projects || []
+    if (accessType === 'cube') {
+      project = entity.project
+    } else if (accessType === 'project') {
+      project = entity.name
+    } else if (accessType === 'model') {
+      project =  ProjectModel.getProjectByCubeModel(entity.name)
+    }
+    for(var i = 0;i<projectAccesses.length;i++){
+      if(projectAccesses[i].name === project) {
+        entity = projectAccesses[i]
+        break;
+      }
+    }
     if (entity) {
       angular.forEach(entity.accessEntities, function (acessEntity, index) {
         if (masks.indexOf(acessEntity.permission.mask) != -1) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/a794544f/webapp/app/partials/common/access.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/common/access.html b/webapp/app/partials/common/access.html
index be0a9d0..ee41e64 100644
--- a/webapp/app/partials/common/access.html
+++ b/webapp/app/partials/common/access.html
@@ -19,7 +19,7 @@
 <div ng-controller="AccessCtrl">
     <div class="space-4"></div>
     <div class="pull-right">
-        <button class="btn btn-primary btn-xs" ng-click="renewAccess(entity)" ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(entity, 16) && !newAccess"><i
+        <button class="btn btn-primary btn-xs" ng-click="renewAccess(entity)" ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',entity, 16) && !newAccess"><i
                 class="fa fa-plus"></i> Grant
         </button>
         <button class="btn btn-primary btn-xs" ng-click="resetNewAcess()" ng-if="newAccess"><i
@@ -72,8 +72,8 @@
                 <th>Name</th>
                 <th>Type</th>
                 <th>Access</th>
-                <th ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(entity, 16)">Update</th>
-                <th ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(entity, 16)">Revoke</th>
+                <th ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',entity, 16)">Update</th>
+                <th ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',entity, 16)">Revoke</th>
             </tr>
         </thead>
         <tbody>
@@ -92,7 +92,7 @@
                     <span ng-if="accessEntity.permission.mask == 64">OPERATION</span>
                     <span ng-if="accessEntity.permission.mask == 16">ADMIN</span>
                 </td>
-                <td ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(entity, 16)">
+                <td ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',entity, 16)">
                     <select ng-model="accessEntity.newPermission"  ng-init="newAccess.permission=permissions.READ.value"
                             ng-options="permission.value as permission.name for (name, permission) in permissions">
                         <option value="">-- select access --</option>
@@ -101,7 +101,7 @@
                             ng-click="update(type, entity, accessEntity, accessEntity.newPermission)">Update
                     </button>
                 </td>
-                <td ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(entity, 16)">
+                <td ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',entity, 16)">
                     <button class="btn btn-default btn-xs" ng-click="revoke(type, accessEntity, entity)">Revoke</button>
                 </td>
             </tr>

http://git-wip-us.apache.org/repos/asf/kylin/blob/a794544f/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 674e3f0..db0ed8d 100755
--- a/webapp/app/partials/cubes/cube_detail.html
+++ b/webapp/app/partials/cubes/cube_detail.html
@@ -26,7 +26,7 @@
             <a href="" ng-click="cube.visiblePage='sql';getCubeSql(cube)">SQL</a>
         </li>
         <li class="{{cube.visiblePage=='json'? 'active':''}}"
-            ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(cube, 16) && !newAccess">
+            ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, 16) && !newAccess">
             <a href="" ng-click="cube.visiblePage='json';">JSON(Cube)</a>
         </li>
         <!--<li class="{{cube.visiblePage=='access'? 'active':''}}"-->
@@ -34,7 +34,7 @@
             <!--<a href="" ng-click="cube.visiblePage='access';listAccess(cube, 'CubeInstance');">Access</a>-->
         <!--</li>-->
         <li class="{{cube.visiblePage=='notification'? 'active':''}}"
-            ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(cube, 16) && !newAccess">
+            ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, 16) && !newAccess">
             <a href="" ng-click="cube.visiblePage='notification';getNotifyListString(cube);">Notification</a>
         </li>
         <li class="{{cube.visiblePage=='hbase'? 'active':''}}"

http://git-wip-us.apache.org/repos/asf/kylin/blob/a794544f/webapp/app/partials/cubes/cubes.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubes/cubes.html b/webapp/app/partials/cubes/cubes.html
index d43b857..22ab122 100644
--- a/webapp/app/partials/cubes/cubes.html
+++ b/webapp/app/partials/cubes/cubes.html
@@ -87,10 +87,10 @@
                             data-toggle="dropdown" ng-click="listAccess(cube, 'CubeInstance')">
                         Action <span class="ace-icon fa fa-caret-down icon-on-right"></span>
                     </button>
-                    <ul ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask)" class="dropdown-menu" role="menu">
+                    <ul ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask)" class="dropdown-menu" role="menu">
                         <li ng-if="cube.status!='READY' && userService.hasRole('ROLE_ADMIN') ">
                             <a ng-click="dropCube(cube)" tooltip="Drop the cube, related jobs and data permanently.">Drop</a></li>
-                        <li ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission(cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))">
+                        <li ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))">
                             <a ng-click="cubeEdit(cube);">Edit</a></li>
                         <li ng-if="cube.status!='DESCBROKEN'"><a ng-click="startJobSubmit(cube);">Build</a></li>
                         <li ng-if="cube.status!='DESCBROKEN'"><a ng-click="startRefresh(cube)">Refresh</a></li>
@@ -101,7 +101,7 @@
                         <li ng-if="cube.status!='DESCBROKEN'"><a ng-click="cloneCube(cube)">Clone</a></li>
 
                     </ul>
-                    <ul ng-if="!(userService.hasRole('ROLE_ADMIN') || hasPermission(cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))" class="dropdown-menu" role="menu">
+                    <ul ng-if="!(userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))" class="dropdown-menu" role="menu">
                         <li><a>N/A</a></li>
                     </ul>
                 </div>

http://git-wip-us.apache.org/repos/asf/kylin/blob/a794544f/webapp/app/partials/models/models_tree.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/models_tree.html b/webapp/app/partials/models/models_tree.html
index 399f839..d6d0b1a 100644
--- a/webapp/app/partials/models/models_tree.html
+++ b/webapp/app/partials/models/models_tree.html
@@ -52,7 +52,7 @@
                 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" ng-click="listModelAccess(model)">
                   Action <span class="ace-icon fa fa-caret-down icon-on-right"></span>
                 </button>
-                <ul class="dropdown-menu" role="menu" ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission(model, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))">
+                <ul class="dropdown-menu" role="menu" ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission('model',model, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))">
                   <li><a ng-click="editModel(model, false)"  title="Edit Model" style="cursor:pointer;margin-right: 8px;" >Edit</a></li>
                   <li><a ng-click="cloneModel(model)" title="Clone Model"  style="cursor:pointer;margin-right: 8px;" >Clone </a></li>
                   <li><a ng-click="dropModel(model)" title="Drop Model"  style="cursor:pointer;margin-right: 8px;">Drop</a></li>

http://git-wip-us.apache.org/repos/asf/kylin/blob/a794544f/webapp/app/partials/projects/projects.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/projects/projects.html b/webapp/app/partials/projects/projects.html
index 96e4a91..95fc359 100644
--- a/webapp/app/partials/projects/projects.html
+++ b/webapp/app/partials/projects/projects.html
@@ -58,10 +58,10 @@
                 <td>{{ project.create_time_utc | utcToConfigTimeZone}}</td>
                 <td>
                     <button class="btn btn-xs btn-info" ng-click="toEdit(project)" tooltip="Edit"
-                            ng-disabled="!(userService.hasRole('ROLE_ADMIN') || hasPermission(project, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))">
+                            ng-disabled="!(userService.hasRole('ROLE_ADMIN') || hasPermission('project',project, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))">
                         <i class="fa fa-pencil"></i></button>
                     <button class="btn btn-xs btn-danger" ng-click="delete(project)" tooltip="Delete"
-                            ng-disabled="!(userService.hasRole('ROLE_ADMIN') || hasPermission(project, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))"
+                            ng-disabled="!(userService.hasRole('ROLE_ADMIN') || hasPermission('project',project, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))"
                             ><i class="fa fa-trash-o"></i></button>
                 </td>
             </tr>


[07/10] kylin git commit: Minor: do not hardcode DefaultQueryTransformer sequence.

Posted by li...@apache.org.
Minor: do not hardcode DefaultQueryTransformer sequence.

(cherry picked from commit 447c9c27aacbc1524a70da195096e8954c03accf)


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

Branch: refs/heads/2.2.x
Commit: 48a08e5f5f112ed2dc0a9408601d265815a42f37
Parents: 5095f1f
Author: Yifan Zhang <ev...@gmail.com>
Authored: Tue Oct 10 14:25:20 2017 +0800
Committer: Yifan Zhang <ev...@gmail.com>
Committed: Wed Oct 18 13:14:14 2017 +0800

----------------------------------------------------------------------
 .../main/resources/kylin-defaults.properties    |  2 +-
 .../query/util/DefaultQueryTransformer.java     | 97 ++++++++++++++++++++
 .../org/apache/kylin/query/util/QueryUtil.java  | 77 +---------------
 3 files changed, 99 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/48a08e5f/core-common/src/main/resources/kylin-defaults.properties
----------------------------------------------------------------------
diff --git a/core-common/src/main/resources/kylin-defaults.properties b/core-common/src/main/resources/kylin-defaults.properties
index e3632ae..75436d6 100644
--- a/core-common/src/main/resources/kylin-defaults.properties
+++ b/core-common/src/main/resources/kylin-defaults.properties
@@ -200,7 +200,7 @@ kylin.query.interceptors=org.apache.kylin.rest.security.TableInterceptor
 kylin.query.escape-default-keyword=false
 
 # Usually should not modify this
-kylin.query.transformers=org.apache.kylin.query.util.KeywordDefaultDirtyHack
+kylin.query.transformers=org.apache.kylin.query.util.DefaultQueryTransformer,org.apache.kylin.query.util.KeywordDefaultDirtyHack
 
 ### SECURITY ###
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/48a08e5f/query/src/main/java/org/apache/kylin/query/util/DefaultQueryTransformer.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/util/DefaultQueryTransformer.java b/query/src/main/java/org/apache/kylin/query/util/DefaultQueryTransformer.java
new file mode 100644
index 0000000..0afe1ed
--- /dev/null
+++ b/query/src/main/java/org/apache/kylin/query/util/DefaultQueryTransformer.java
@@ -0,0 +1,97 @@
+/*
+ * 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.util;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.kylin.query.util.QueryUtil.IQueryTransformer;
+
+public class DefaultQueryTransformer implements IQueryTransformer {
+
+    private static final String S0 = "\\s*";
+    private static final String S1 = "\\s";
+    private static final String SM = "\\s+";
+    private static final Pattern PTN_GROUP_BY = Pattern.compile(S1 + "GROUP" + SM + "BY" + S1,
+            Pattern.CASE_INSENSITIVE);
+    private static final Pattern PTN_HAVING_COUNT_GREATER_THAN_ZERO = Pattern.compile(S1 + "HAVING" + SM + "[(]?" + S0
+            + "COUNT" + S0 + "[(]" + S0 + "1" + S0 + "[)]" + S0 + ">" + S0 + "0" + S0 + "[)]?",
+            Pattern.CASE_INSENSITIVE);
+    private static final Pattern PTN_SUM_1 = Pattern.compile(S0 + "SUM" + S0 + "[(]" + S0 + "[1]" + S0 + "[)]" + S0,
+            Pattern.CASE_INSENSITIVE);
+    private static final Pattern PTN_NOT_EQ = Pattern.compile(S0 + "!=" + S0, Pattern.CASE_INSENSITIVE);
+    private static final Pattern PTN_INTERVAL = Pattern.compile(
+            "interval" + SM + "(floor\\()([\\d\\.]+)(\\))" + SM + "(second|minute|hour|day|month|year)",
+            Pattern.CASE_INSENSITIVE);
+    private static final Pattern PTN_HAVING_ESCAPE_FUNCTION = Pattern.compile("\\{fn" + "(.*?)" + "\\}",
+            Pattern.CASE_INSENSITIVE);
+
+    @Override
+    public String transform(String sql, String project, String defaultSchema) {
+        Matcher m;
+
+        // Case {fn EXTRACT(...) }
+        // Use non-greedy regrex matching to remove escape functions
+        while (true) {
+            m = PTN_HAVING_ESCAPE_FUNCTION.matcher(sql);
+            if (!m.find())
+                break;
+            sql = sql.substring(0, m.start()) + m.group(1) + sql.substring(m.end());
+        }
+
+        // Case: HAVING COUNT(1)>0 without Group By
+        // Tableau generates: SELECT SUM(1) AS "COL" FROM "VAC_SW" HAVING
+        // COUNT(1)>0
+        m = PTN_HAVING_COUNT_GREATER_THAN_ZERO.matcher(sql);
+        if (m.find() && PTN_GROUP_BY.matcher(sql).find() == false) {
+            sql = sql.substring(0, m.start()) + " " + sql.substring(m.end());
+        }
+
+        // Case: SUM(1)
+        // Replace it with COUNT(1)
+        while (true) {
+            m = PTN_SUM_1.matcher(sql);
+            if (!m.find())
+                break;
+            sql = sql.substring(0, m.start()) + " COUNT(1) " + sql.substring(m.end());
+        }
+
+        // Case: !=
+        // Replace it with <>
+        while (true) {
+            m = PTN_NOT_EQ.matcher(sql);
+            if (!m.find())
+                break;
+            sql = sql.substring(0, m.start()) + " <> " + sql.substring(m.end());
+        }
+
+        // ( date '2001-09-28' + interval floor(1) day ) generated by cognos
+        // calcite only recognizes date '2001-09-28' + interval '1' day
+        while (true) {
+            m = PTN_INTERVAL.matcher(sql);
+            if (!m.find())
+                break;
+
+            int value = (int) Math.floor(Double.valueOf(m.group(2)));
+            sql = sql.substring(0, m.start(1)) + "'" + value + "'" + sql.substring(m.end(3));
+        }
+
+        return sql;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/kylin/blob/48a08e5f/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java b/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java
index 377ca89..ab9d490 100644
--- a/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java
+++ b/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java
@@ -75,7 +75,6 @@ public class QueryUtil {
 
     private static void initQueryTransformers() {
         List<IQueryTransformer> transformers = Lists.newArrayList();
-        transformers.add(new DefaultQueryTransformer());
 
         String[] classes = KylinConfig.getInstanceFromEnv().getQueryTransformers();
         for (String clz : classes) {
@@ -86,82 +85,8 @@ public class QueryUtil {
                 throw new RuntimeException("Failed to init query transformer", e);
             }
         }
-        queryTransformers = transformers;
-    }
-
-    // correct sick / invalid SQL
-    private static class DefaultQueryTransformer implements IQueryTransformer {
-
-        private static final String S0 = "\\s*";
-        private static final String S1 = "\\s";
-        private static final String SM = "\\s+";
-        private static final Pattern PTN_GROUP_BY = Pattern.compile(S1 + "GROUP" + SM + "BY" + S1,
-                Pattern.CASE_INSENSITIVE);
-        private static final Pattern PTN_HAVING_COUNT_GREATER_THAN_ZERO = Pattern.compile(S1 + "HAVING" + SM + "[(]?"
-                + S0 + "COUNT" + S0 + "[(]" + S0 + "1" + S0 + "[)]" + S0 + ">" + S0 + "0" + S0 + "[)]?",
-                Pattern.CASE_INSENSITIVE);
-        private static final Pattern PTN_SUM_1 = Pattern.compile(S0 + "SUM" + S0 + "[(]" + S0 + "[1]" + S0 + "[)]" + S0,
-                Pattern.CASE_INSENSITIVE);
-        private static final Pattern PTN_NOT_EQ = Pattern.compile(S0 + "!=" + S0, Pattern.CASE_INSENSITIVE);
-        private static final Pattern PTN_INTERVAL = Pattern.compile(
-                "interval" + SM + "(floor\\()([\\d\\.]+)(\\))" + SM + "(second|minute|hour|day|month|year)",
-                Pattern.CASE_INSENSITIVE);
-        private static final Pattern PTN_HAVING_ESCAPE_FUNCTION = Pattern.compile("\\{fn" + "(.*?)" + "\\}",
-                Pattern.CASE_INSENSITIVE);
-
-        @Override
-        public String transform(String sql, String project, String defaultSchema) {
-            Matcher m;
-
-            // Case fn{ EXTRACT(...) }
-            // Use non-greedy regrex matching to remove escape functions
-            while (true) {
-                m = PTN_HAVING_ESCAPE_FUNCTION.matcher(sql);
-                if (!m.find())
-                    break;
-                sql = sql.substring(0, m.start()) + m.group(1) + sql.substring(m.end());
-            }
-
-            // Case: HAVING COUNT(1)>0 without Group By
-            // Tableau generates: SELECT SUM(1) AS "COL" FROM "VAC_SW" HAVING
-            // COUNT(1)>0
-            m = PTN_HAVING_COUNT_GREATER_THAN_ZERO.matcher(sql);
-            if (m.find() && PTN_GROUP_BY.matcher(sql).find() == false) {
-                sql = sql.substring(0, m.start()) + " " + sql.substring(m.end());
-            }
-
-            // Case: SUM(1)
-            // Replace it with COUNT(1)
-            while (true) {
-                m = PTN_SUM_1.matcher(sql);
-                if (!m.find())
-                    break;
-                sql = sql.substring(0, m.start()) + " COUNT(1) " + sql.substring(m.end());
-            }
-
-            // Case: !=
-            // Replace it with <>
-            while (true) {
-                m = PTN_NOT_EQ.matcher(sql);
-                if (!m.find())
-                    break;
-                sql = sql.substring(0, m.start()) + " <> " + sql.substring(m.end());
-            }
-
-            // ( date '2001-09-28' + interval floor(1) day ) generated by cognos
-            // calcite only recognizes date '2001-09-28' + interval '1' day
-            while (true) {
-                m = PTN_INTERVAL.matcher(sql);
-                if (!m.find())
-                    break;
-
-                int value = (int) Math.floor(Double.valueOf(m.group(2)));
-                sql = sql.substring(0, m.start(1)) + "'" + value + "'" + sql.substring(m.end(3));
-            }
-
-            return sql;
-        }
 
+        queryTransformers = transformers;
     }
 
     public static String makeErrorMsgUserFriendly(Throwable e) {


[06/10] kylin git commit: KYLIN-2775 fix non-default database issue in sample model/cube (#2791)

Posted by li...@apache.org.
KYLIN-2775 fix non-default database issue in sample model/cube (#2791)



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

Branch: refs/heads/2.2.x
Commit: 5095f1fe165dc82f860e6801f3b53144496f9c44
Parents: a794544
Author: Billy(Yiming) Liu <li...@gmail.com>
Authored: Tue Oct 17 09:17:59 2017 -0500
Committer: Billy Liu <bi...@apache.org>
Committed: Tue Oct 17 22:19:41 2017 +0800

----------------------------------------------------------------------
 build/bin/sample.sh | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/5095f1fe/build/bin/sample.sh
----------------------------------------------------------------------
diff --git a/build/bin/sample.sh b/build/bin/sample.sh
index ee4aa25..0809d2b 100755
--- a/build/bin/sample.sh
+++ b/build/bin/sample.sh
@@ -97,7 +97,9 @@ sed -i "s/%default_version%/${kylin_version}/g" ${KYLIN_HOME}/sample_cube/metada
 
 #### Replace the 'DEFAULT' with kylin.source.hive.database-for-flat-table
 sed -i "s/DEFAULT./$sample_database./g" ${KYLIN_HOME}/sample_cube/metadata/cube_desc/kylin_sales_cube.json
+sed -i "s/DEFAULT./$sample_database./g" ${KYLIN_HOME}/sample_cube/metadata/cube_desc/kylin_streaming_cube.json
 sed -i "s/DEFAULT./$sample_database./g" ${KYLIN_HOME}/sample_cube/metadata/model_desc/kylin_sales_model.json
+sed -i "s/DEFAULT./$sample_database./g" ${KYLIN_HOME}/sample_cube/metadata/model_desc/kylin_streaming_model.json
 sed -i "s/DEFAULT./$sample_database./g" ${KYLIN_HOME}/sample_cube/metadata/project/learn_kylin.json
 sed -i "s/DEFAULT/$sample_database/g" ${KYLIN_HOME}/sample_cube/metadata/table/*.json
 cd ${KYLIN_HOME}/sample_cube/metadata/table


[09/10] kylin git commit: remove access condition of modeler (#2798)

Posted by li...@apache.org.
remove access condition of modeler (#2798)

* remove access condition of modeler

* kylin remove useless console


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

Branch: refs/heads/2.2.x
Commit: 76040d5acfb3c0e4e04e3de337b3807173e1fa50
Parents: 3ead3c9
Author: luguosheng1314 <55...@qq.com>
Authored: Wed Oct 18 01:33:02 2017 -0500
Committer: lidongsjtu <li...@apache.org>
Committed: Wed Oct 18 14:47:01 2017 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/page.js                 |  2 +-
 webapp/app/partials/cubes/cubes.html              | 14 +++++++-------
 webapp/app/partials/jobs/jobs.html                |  6 +++---
 webapp/app/partials/models/model_schema.html      |  2 +-
 webapp/app/partials/models/models.html            |  4 ++--
 webapp/app/partials/models/models_tree.html       | 10 +++++-----
 webapp/app/partials/projects/projects.html        |  6 +++---
 webapp/app/partials/query/query.html              |  4 ++--
 webapp/app/partials/tables/source_table_tree.html |  6 +++---
 webapp/app/partials/tables/table_detail.html      |  6 +++---
 10 files changed, 30 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/js/controllers/page.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/page.js b/webapp/app/js/controllers/page.js
index 5a77195..54cb643 100644
--- a/webapp/app/js/controllers/page.js
+++ b/webapp/app/js/controllers/page.js
@@ -105,7 +105,7 @@ KylinApp.controller('PageCtrl', function ($scope, $q, AccessService, $modal, $lo
     if (accessType === 'cube') {
       project = entity.project
     } else if (accessType === 'project') {
-      project = entity.name
+      project = entity && entity.name || entity.selectedProject
     } else if (accessType === 'model') {
       project =  ProjectModel.getProjectByCubeModel(entity.name)
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/partials/cubes/cubes.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubes/cubes.html b/webapp/app/partials/cubes/cubes.html
index 22ab122..8528968 100644
--- a/webapp/app/partials/cubes/cubes.html
+++ b/webapp/app/partials/cubes/cubes.html
@@ -87,18 +87,18 @@
                             data-toggle="dropdown" ng-click="listAccess(cube, 'CubeInstance')">
                         Action <span class="ace-icon fa fa-caret-down icon-on-right"></span>
                     </button>
-                    <ul ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask)" class="dropdown-menu" role="menu">
-                        <li ng-if="cube.status!='READY' && userService.hasRole('ROLE_ADMIN') ">
+                    <ul ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask,permissions.OPERATION.mask)" class="dropdown-menu" role="menu">
+                        <li ng-if="cube.status!='READY' && (userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))">
                             <a ng-click="dropCube(cube)" tooltip="Drop the cube, related jobs and data permanently.">Drop</a></li>
-                        <li ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))">
+                        <li ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask)">
                             <a ng-click="cubeEdit(cube);">Edit</a></li>
                         <li ng-if="cube.status!='DESCBROKEN'"><a ng-click="startJobSubmit(cube);">Build</a></li>
                         <li ng-if="cube.status!='DESCBROKEN'"><a ng-click="startRefresh(cube)">Refresh</a></li>
                         <li ng-if="cube.status!='DESCBROKEN'"><a ng-click="startMerge(cube)">Merge</a></li>
-                        <li ng-if="cube.status=='READY'"><a ng-click="disable(cube)">Disable</a></li>
-                        <li ng-if="cube.status=='DISABLED'"><a ng-click="enable(cube)">Enable</a></li>
-                        <li ng-if="cube.status=='DISABLED'"><a ng-click="purge(cube)">Purge</a></li>
-                        <li ng-if="cube.status!='DESCBROKEN'"><a ng-click="cloneCube(cube)">Clone</a></li>
+                        <li ng-if="cube.status=='READY' && (userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))"><a ng-click="disable(cube)">Disable</a></li>
+                        <li ng-if="cube.status=='DISABLED' && (userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))"><a ng-click="enable(cube)">Enable</a></li>
+                        <li ng-if="cube.status=='DISABLED' && (userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))"><a ng-click="purge(cube)">Purge</a></li>
+                        <li ng-if="cube.status!='DESCBROKEN' && (userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))"><a ng-click="cloneCube(cube)">Clone</a></li>
 
                     </ul>
                     <ul ng-if="!(userService.hasRole('ROLE_ADMIN') || hasPermission('cube',cube, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))" class="dropdown-menu" role="menu">

http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/partials/jobs/jobs.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/jobs/jobs.html b/webapp/app/partials/jobs/jobs.html
index 78c2220..7c8de32 100644
--- a/webapp/app/partials/jobs/jobs.html
+++ b/webapp/app/partials/jobs/jobs.html
@@ -20,9 +20,9 @@
   <!--Project: -->
   <div class="col-xs-3">
     <form ng-if="userService.isAuthorized()">
-      <div class="form-group" ng-if="userService.hasRole('ROLE_MODELER')" >
-        <a class="btn btn-xs btn-info" href="projects" tooltip="Manage Project"><i class="fa fa-gears"></i></a>
-        <a class="btn btn-xs btn-primary" ng-if="userService.hasRole('ROLE_MODELER')" style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
+      <div class="form-group" >
+        <a class="btn btn-xs btn-info"  href="projects" tooltip="Manage Project"><i class="fa fa-gears"></i></a>
+        <a class="btn btn-xs btn-primary" ng-if="userService.hasRole('ROLE_ADMIN')"  style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
           <i class="fa fa-plus"></i>
         </a>
       </div>

http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/partials/models/model_schema.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/model_schema.html b/webapp/app/partials/models/model_schema.html
index 3a332de..f265521 100644
--- a/webapp/app/partials/models/model_schema.html
+++ b/webapp/app/partials/models/model_schema.html
@@ -71,7 +71,7 @@
         </div>
         <div class="box-body">
             <p>
-                <a href="models/add" ng-if="userService.hasRole('ROLE_MODELER')">Click here to create your model</a>
+                <a href="models/add" ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',projectModel, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask)">Click here to create your model</a>
             </p>
         </div><!-- /.box-body -->
     </div>

http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/partials/models/models.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/models.html b/webapp/app/partials/models/models.html
index c8e6ed1..3f75ff8 100644
--- a/webapp/app/partials/models/models.html
+++ b/webapp/app/partials/models/models.html
@@ -19,9 +19,9 @@
 <div class="page-header" style="height: 50px;">
     <!--Project-->
     <form class="navbar-form navbar-left" style="margin-top: 0px !important;" ng-if="userService.isAuthorized()">
-        <div class="form-group" ng-if="userService.hasRole('ROLE_MODELER')" >
+        <div class="form-group" >
             <a class="btn btn-xs btn-info" href="projects" tooltip="Manage Project"><i class="fa fa-gears"></i></a>
-          <a class="btn btn-xs btn-primary" ng-if="userService.hasRole('ROLE_MODELER')" style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
+          <a class="btn btn-xs btn-primary" ng-if="userService.hasRole('ROLE_ADMIN')"  style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
                 <i class="fa fa-plus"></i>
             </a>
         </div>

http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/partials/models/models_tree.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/models_tree.html b/webapp/app/partials/models/models_tree.html
index d6d0b1a..d8aae34 100644
--- a/webapp/app/partials/models/models_tree.html
+++ b/webapp/app/partials/models/models_tree.html
@@ -20,15 +20,15 @@
     <div class="row">
       <div class="col-xs-12" style="margin-top:10px;">
         <!--<i class="fa fa-plus fa-2x" style="color:green;"> New</i>-->
-        <a ng-if="userService.hasRole('ROLE_MODELER')" class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="true">
+        <a ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',projectModel, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask)" class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="true">
           <i class="fa fa-plus fa-2x" style="color:#2e8965;"> New<span class="caret"></span></i>
           <!--<i> New </i> <span class="caret"></span>-->
         </a>
         <ul class="dropdown-menu">
-          <li ng-if="userService.hasRole('ROLE_MODELER')">
-            <a href="models/add"><i class="fa fa-star"></i>New Model</a>
+           <li  ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',projectModel, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask)">
+             <a href="models/add"><i class="fa fa-star"></i>New Model</a>
           </li>
-          <li ng-if="userService.hasRole('ROLE_MODELER')">
+          <li ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',projectModel, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask)">
             <a href="cubes/add"><i class="fa fa-cube"></i>New Cube</a>
           </li>
 
@@ -52,7 +52,7 @@
                 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" ng-click="listModelAccess(model)">
                   Action <span class="ace-icon fa fa-caret-down icon-on-right"></span>
                 </button>
-                <ul class="dropdown-menu" role="menu" ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission('model',model, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))">
+                <ul class="dropdown-menu" role="menu" ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission('model',model, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))">
                   <li><a ng-click="editModel(model, false)"  title="Edit Model" style="cursor:pointer;margin-right: 8px;" >Edit</a></li>
                   <li><a ng-click="cloneModel(model)" title="Clone Model"  style="cursor:pointer;margin-right: 8px;" >Clone </a></li>
                   <li><a ng-click="dropModel(model)" title="Drop Model"  style="cursor:pointer;margin-right: 8px;">Drop</a></li>

http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/partials/projects/projects.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/projects/projects.html b/webapp/app/partials/projects/projects.html
index 95fc359..29126ce 100644
--- a/webapp/app/partials/projects/projects.html
+++ b/webapp/app/partials/projects/projects.html
@@ -17,7 +17,7 @@
 -->
 
 <div class="page-header">
-    <button class="btn btn-primary btn-sm" ng-if="userService.hasRole('ROLE_MODELER')" ng-click="toCreateProj()"><i class="fa fa-plus"></i> Project</button>
+    <button class="btn btn-primary btn-sm" ng-if="userService.hasRole('ROLE_ADMIN')" ng-click="toCreateProj()"><i class="fa fa-plus"></i> Project</button>
 </div>
 
 <div ng-if="!loading && projects.length == 0">
@@ -58,10 +58,10 @@
                 <td>{{ project.create_time_utc | utcToConfigTimeZone}}</td>
                 <td>
                     <button class="btn btn-xs btn-info" ng-click="toEdit(project)" tooltip="Edit"
-                            ng-disabled="!(userService.hasRole('ROLE_ADMIN') || hasPermission('project',project, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))">
+                            ng-disabled="!(userService.hasRole('ROLE_ADMIN') || hasPermission('project',project, permissions.ADMINISTRATION.mask))">
                         <i class="fa fa-pencil"></i></button>
                     <button class="btn btn-xs btn-danger" ng-click="delete(project)" tooltip="Delete"
-                            ng-disabled="!(userService.hasRole('ROLE_ADMIN') || hasPermission('project',project, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))"
+                            ng-disabled="!userService.hasRole('ROLE_ADMIN')"
                             ><i class="fa fa-trash-o"></i></button>
                 </td>
             </tr>

http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/partials/query/query.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/query/query.html b/webapp/app/partials/query/query.html
index 5117bd8..b07ca8a 100644
--- a/webapp/app/partials/query/query.html
+++ b/webapp/app/partials/query/query.html
@@ -19,9 +19,9 @@
 <div class="page-header" style="height: 50px;">
     <!--Project-->
     <form class="navbar-form navbar-left" style="margin-top: 0px !important;" ng-if="userService.isAuthorized()">
-        <div class="form-group" ng-if="userService.hasRole('ROLE_MODELER')">
+        <div class="form-group" >
             <a class="btn btn-xs btn-info" href="projects" tooltip="Manage Project"><i class="fa fa-gears"></i></a>
-          <a class="btn btn-xs btn-primary" ng-if="userService.hasRole('ROLE_MODELER')" style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
+          <a class="btn btn-xs btn-primary" ng-if="userService.hasRole('ROLE_ADMIN')" style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
                 <i class="fa fa-plus"></i>
             </a>
         </div>

http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/partials/tables/source_table_tree.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/source_table_tree.html b/webapp/app/partials/tables/source_table_tree.html
index e8ec286..4eb63a1 100755
--- a/webapp/app/partials/tables/source_table_tree.html
+++ b/webapp/app/partials/tables/source_table_tree.html
@@ -25,9 +25,9 @@
         <!--button-->
         <div class="col-xs-5" style="padding-left: 0px;margin-top: 20px;">
             <div class="pull-right">
-              <a class="btn btn-xs btn-primary" tooltip="Load Hive Table"  ng-if="userService.hasRole('ROLE_ADMIN')"  ng-click="openModal()"><i class="fa fa-download"></i></a>
-              <a class="btn btn-xs btn-info" tooltip="Load Hive Table From Tree"  ng-if="userService.hasRole('ROLE_ADMIN')"  ng-click="openTreeModal()"><i class="fa fa-download"></i></a>
-              <a class="btn btn-xs btn-primary" tooltip="Add Streaming Table"  ng-if="userService.hasRole('ROLE_ADMIN')"  ng-click="openStreamingSourceModal()"><i class="fa fa-area-chart"></i></a>
+              <a class="btn btn-xs btn-primary" tooltip="Load Hive Table"  ng-if="userService.hasRole('ROLE_ADMIN')|| hasPermission('project',projectModel, permissions.ADMINISTRATION.mask)"  ng-click="openModal()"><i class="fa fa-download"></i></a>
+              <a class="btn btn-xs btn-info" tooltip="Load Hive Table From Tree"  ng-if="userService.hasRole('ROLE_ADMIN')|| hasPermission('project',projectModel, permissions.ADMINISTRATION.mask)"  ng-click="openTreeModal()"><i class="fa fa-download"></i></a>
+              <a class="btn btn-xs btn-primary" tooltip="Add Streaming Table"  ng-if="userService.hasRole('ROLE_ADMIN')|| hasPermission('project',projectModel, permissions.ADMINISTRATION.mask)"  ng-click="openStreamingSourceModal()"><i class="fa fa-area-chart"></i></a>
             </div>
         </div>
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/76040d5a/webapp/app/partials/tables/table_detail.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/table_detail.html b/webapp/app/partials/tables/table_detail.html
index 7f299b4..4b3f328 100644
--- a/webapp/app/partials/tables/table_detail.html
+++ b/webapp/app/partials/tables/table_detail.html
@@ -19,8 +19,8 @@
 <div ng-controller="SourceMetaCtrl" class="nav-tabs-custom">
   <div class="col-xs-12" ng-show="tableModel.selectedSrcDb&&tableModel.selectedSrcTable.name">
     <h3 class="text-info">Table Schema:{{ tableModel.selectedSrcTable.name}}</h3>
-    <a class="btn btn-primary pull-right" ng-if="userService.hasRole('ROLE_ADMIN')" ng-click="unloadTable(tableModel.selectedSrcTable.database+'.'+tableModel.selectedSrcTable.name)" style="margin-left:10px;" ><span class="fa fa-remove"></span>&nbsp;Unload Table</a>
-    <a class="btn btn-success pull-right" ng-if="tableModel.selectedSrcTable.source_type==0&&userService.hasRole('ROLE_ADMIN')"  ng-click="reloadTable(tableModel.selectedSrcTable.database+'.'+tableModel.selectedSrcTable.name)" style="margin-left:10px;" ><span class="fa fa-download"></span>&nbsp;Reload Table</a>
+    <a class="btn btn-primary pull-right" ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',projectModel, permissions.ADMINISTRATION.mask)" ng-click="unloadTable(tableModel.selectedSrcTable.database+'.'+tableModel.selectedSrcTable.name)" style="margin-left:10px;" ><span class="fa fa-remove"></span>&nbsp;Unload Table</a>
+    <a class="btn btn-success pull-right" ng-if="tableModel.selectedSrcTable.source_type==0&&(userService.hasRole('ROLE_ADMIN') || hasPermission('project',projectModel, permissions.ADMINISTRATION.mask))"  ng-click="reloadTable(tableModel.selectedSrcTable.database+'.'+tableModel.selectedSrcTable.name)" style="margin-left:10px;" ><span class="fa fa-download"></span>&nbsp;Reload Table</a>
     <div class="tabbable nav-tabs-custom">
       <ul class="nav nav-tabs">
         <li class="active">
@@ -185,7 +185,7 @@
       </div>
       <div class="box-body">
         <div>
-          <a tooltip="Load Hive Table" href="javascript:void(0);" ng-if="userService.hasRole('ROLE_MODELER')"
+          <a tooltip="Load Hive Table" href="javascript:void(0);" ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission('project',projectModel, permissions.ADMINISTRATION.mask)"
              ng-click="openModal()">Click here to load your hive table</a>
         </div>
       </div>


[10/10] kylin git commit: Merge commit 'd25ac5d00bc70f5e9d62f7ebcc6dd547ce0d846d'

Posted by li...@apache.org.
Merge commit 'd25ac5d00bc70f5e9d62f7ebcc6dd547ce0d846d'


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

Branch: refs/heads/2.2.x
Commit: 53cad89b3005049aea68802b0e56d15ca3e35607
Parents: 76040d5 d25ac5d
Author: lidongsjtu <li...@apache.org>
Authored: Wed Oct 18 16:38:20 2017 +0800
Committer: lidongsjtu <li...@apache.org>
Committed: Wed Oct 18 16:38:20 2017 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kylin/measure/hllc/HLLCSerializer.java   | 2 +-
 .../org/apache/kylin/measure/percentile/PercentileSerializer.java | 2 +-
 .../src/main/java/org/apache/kylin/measure/raw/RawSerializer.java | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[04/10] kylin git commit: minor, fix UT

Posted by li...@apache.org.
minor, fix UT



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

Branch: refs/heads/2.2.x
Commit: 32b24008fd676bed3301ee1a19d3df271eb6bba5
Parents: 9a51ed8
Author: Dong Li <li...@apache.org>
Authored: Tue Oct 17 03:58:05 2017 -0500
Committer: lidongsjtu <li...@apache.org>
Committed: Tue Oct 17 17:00:16 2017 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/rest/controller/CubeControllerTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/32b24008/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java b/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
index 950f0b4..8ee4342 100644
--- a/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
@@ -124,7 +124,7 @@ public class CubeControllerTest extends ServiceTestBase {
         List<CubeInstanceResponse> cubeInstances = cubeController.getCubes(newCubeName, cube.getModelName(), "default",
                 1, 0);
 
-        CubeInstance cubeInstance = cubeInstances.get(0);
+        CubeInstance cubeInstance = cubeController.getCube(cubeInstances.get(0).getName());
         Assert.assertTrue(cubeInstance.getDescriptor().getNotifyList().contains("john@example.com"));
         Assert.assertTrue(cubeInstance.getCost() == 80);
         cubeController.deleteCube(newCubeName);