You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by bi...@apache.org on 2016/12/07 06:02:52 UTC
kylin git commit: minor, Get cuboid combination number from cube API
Repository: kylin
Updated Branches:
refs/heads/yang22 3a120f3e6 -> 8a42973d3
minor, Get cuboid combination number from cube API
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/8a42973d
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/8a42973d
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/8a42973d
Branch: refs/heads/yang22
Commit: 8a42973d329ccf61f9b7e4b56246dd6ce2501db8
Parents: 3a120f3
Author: Billy Liu <bi...@apache.org>
Authored: Wed Dec 7 14:02:43 2016 +0800
Committer: Billy Liu <bi...@apache.org>
Committed: Wed Dec 7 14:02:43 2016 +0800
----------------------------------------------------------------------
.../kylin/rest/controller/CubeController.java | 33 ++++++++++++++++++++
1 file changed, 33 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/8a42973d/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 3846d28..8dce112 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
@@ -32,6 +32,7 @@ import org.apache.kylin.common.util.JsonUtil;
import org.apache.kylin.cube.CubeInstance;
import org.apache.kylin.cube.CubeManager;
import org.apache.kylin.cube.CubeSegment;
+import org.apache.kylin.cube.model.AggregationGroup;
import org.apache.kylin.cube.model.CubeBuildTypeEnum;
import org.apache.kylin.cube.model.CubeDesc;
import org.apache.kylin.dimension.DimensionEncodingFactory;
@@ -645,6 +646,22 @@ public class CubeController extends BasicController {
return response;
}
+ /**
+ * Calculate Cuboid Combination based on the AggreationGroup definition.
+ *
+ * @param aggregationGroupStr
+ * @return number of cuboid, -1 if failed
+ */
+ @RequestMapping(value = "aggregationgroups/cuboid", method = RequestMethod.GET)
+ @ResponseBody
+ public long calculateCuboidCombination(@RequestBody String aggregationGroupStr) {
+ AggregationGroup aggregationGroup = deserializeAggregationGroup(aggregationGroupStr);
+ if (aggregationGroup != null) {
+ return aggregationGroup.calculateCuboidCombination();
+ } else
+ return -1;
+ }
+
private CubeDesc deserializeCubeDesc(CubeRequest cubeRequest) {
CubeDesc desc = null;
try {
@@ -663,6 +680,22 @@ public class CubeController extends BasicController {
return desc;
}
+ private AggregationGroup deserializeAggregationGroup(String aggregationGroupStr) {
+ AggregationGroup aggreationGroup = null;
+ try {
+ logger.debug("Parsing AggregationGroup " + aggregationGroupStr);
+ aggreationGroup = JsonUtil.readValue(aggregationGroupStr, AggregationGroup.class);
+ } catch (JsonParseException e) {
+ logger.error("The AggregationGroup definition is not valid.", e);
+ } catch (JsonMappingException e) {
+ logger.error("The AggregationGroup definition is not valid.", e);
+ } catch (IOException e) {
+ logger.error("Failed to deal with the request.", e);
+ throw new InternalErrorException("Failed to deal with the request:" + e.getMessage(), e);
+ }
+ return aggreationGroup;
+ }
+
private void updateRequest(CubeRequest request, boolean success, String message) {
request.setCubeDescData("");
request.setSuccessful(success);