[22/50] [abbrv] lens git commit: LENS-871 : Fix Dropping any partition in dimtable is clearing latest cache for that dimtable.
LENS-871 : Fix Dropping any partition in dimtable is clearing latest cache for that dimtable. Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/87049563 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/87049563 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/87049563 Branch: refs/heads/LENS-581 Commit: 87049563a4cbc20cf510f6906bf67ddd330ef508 Parents: f7ab827 Author: Rajat KhandelwalAuthored: Wed Nov 25 16:53:23 2015 +0530 Committer: Amareshwari Sriramadasu Committed: Wed Nov 25 16:53:23 2015 +0530 -- .../lens/cube/metadata/CubeFactTable.java |2 +- .../lens/cube/metadata/CubeMetastoreClient.java | 273 ++- .../lens/cube/metadata/FactPartition.java |2 +- .../lens/cube/metadata/MetastoreUtil.java | 122 +- .../org/apache/lens/cube/metadata/Storage.java |2 +- .../cube/metadata/StoragePartitionDesc.java |2 +- .../lens/cube/metadata/StorageTableDesc.java| 21 + .../lens/cube/metadata/TimePartition.java |4 +- .../apache/lens/cube/metadata/UpdatePeriod.java | 42 +- .../org/apache/lens/cube/parse/DateUtil.java| 13 - .../cube/metadata/TestCubeMetastoreClient.java | 1740 +++--- .../lens/cube/metadata/TestFactPartition.java |4 +- .../lens/cube/metadata/TestTimePartition.java |2 +- .../lens/cube/metadata/UpdatePeriodTest.java|2 +- .../apache/lens/cube/parse/CubeTestSetup.java | 52 +- .../lens/cube/parse/TestBaseCubeQueries.java|4 +- .../cube/parse/TestBetweenTimeRangeWriter.java |2 +- .../lens/cube/parse/TestORTimeRangeWriter.java | 14 +- .../apache/lens/driver/hive/TestHiveDriver.java |2 +- .../apache/lens/server/api/util/LensUtil.java | 10 + .../metastore/CubeMetastoreServiceImpl.java |8 +- .../apache/lens/server/metastore/JAXBUtils.java |2 +- .../server/metastore/TestMetastoreService.java | 343 ++-- 23 files changed, 1167 insertions(+), 1501 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/87049563/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java index a7a5bb0..d6bfb79 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java @@ -154,7 +154,7 @@ public class CubeFactTable extends AbstractCubeTable { List partitions = new ArrayList(); Date dt = cal.getTime(); while (dt.compareTo(toDate) < 0) { - String part = interval.format().format(cal.getTime()); + String part = interval.format(cal.getTime()); partitions.add(part); cal.add(interval.calendarField(), 1); dt = cal.getTime(); http://git-wip-us.apache.org/repos/asf/lens/blob/87049563/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java index 1f13617..e7550ca 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java @@ -19,7 +19,7 @@ package org.apache.lens.cube.metadata; -import static org.apache.lens.cube.metadata.MetastoreUtil.getFactOrDimtableStorageTableName; +import static org.apache.lens.cube.metadata.MetastoreUtil.*; import java.text.ParseException; import java.util.*; @@ -31,6 +31,7 @@ import org.apache.lens.cube.metadata.Storage.LatestPartColumnInfo; import org.apache.lens.cube.metadata.timeline.PartitionTimeline; import org.apache.lens.cube.metadata.timeline.PartitionTimelineFactory; import org.apache.lens.server.api.error.LensException; +import org.apache.lens.server.api.util.LensUtil; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.hive.conf.HiveConf; @@ -103,9 +104,9 @@ public class CubeMetastoreClient { * latest date for a single fact-storage table for given time dimension is the latest of the latest dates for all its * update periods * - * @param cube - * @param timeDimension - * @return + * @param cube Cube to get latest date of + * @param timeDimensiontime dimension + * @return latest date among all facts of cube in timeDimension * @throws HiveException * @throws LensException */ @@ -213,7 +214,7 @@ public class
[15/50] [abbrv] lens git commit: LENS-865 : Fix test failures
LENS-865 : Fix test failures Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/b66592ce Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/b66592ce Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/b66592ce Branch: refs/heads/LENS-581 Commit: b66592ce9b685c5a9f8c7b0b855032fc53d2bab4 Parents: f41c176 Author: Rajat KhandelwalAuthored: Tue Nov 24 16:57:52 2015 +0530 Committer: Amareshwari Sriramadasu Committed: Tue Nov 24 16:57:52 2015 +0530 -- .../lens/cube/metadata/TestCubeMetastoreClient.java | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/b66592ce/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java b/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java index 6b6f645..d938ff7 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java @@ -2047,9 +2047,9 @@ public class TestCubeMetastoreClient { assertEquals(parts.get(0).getParameters().get(MetastoreUtil.getLatestPartTimestampKey("dt")), HOURLY.format().format(nowPlus1)); -client.dropPartition(cubeDim.getName(), c1, timeParts, null, HOURLY); -Assert.assertTrue(client.dimPartitionExists(cubeDim.getName(), c1, timeParts2)); -Assert.assertFalse(client.dimPartitionExists(cubeDim.getName(), c1, timeParts)); +client.dropPartition(cubeDim.getName(), c1, timeParts2, null, HOURLY); +Assert.assertTrue(client.dimPartitionExists(cubeDim.getName(), c1, timeParts)); +Assert.assertFalse(client.dimPartitionExists(cubeDim.getName(), c1, timeParts2)); Assert .assertTrue(client.latestPartitionExists(cubeDim.getName(), c1, TestCubeMetastoreClient.getDatePartitionKey())); Assert.assertTrue(client.dimTableLatestPartitionExists(storageTableName)); @@ -2057,10 +2057,10 @@ public class TestCubeMetastoreClient { assertEquals(1, parts.size()); assertEquals(TextInputFormat.class.getCanonicalName(), parts.get(0).getInputFormatClass().getCanonicalName()); assertEquals(parts.get(0).getParameters().get(MetastoreUtil.getLatestPartTimestampKey("dt")), - HOURLY.format().format(nowPlus1)); + HOURLY.format().format(now)); assertEquals(client.getAllParts(storageTableName).size(), 2); -client.dropPartition(cubeDim.getName(), c1, timeParts2, null, HOURLY); +client.dropPartition(cubeDim.getName(), c1, timeParts, null, HOURLY); Assert.assertFalse(client.dimPartitionExists(cubeDim.getName(), c1, timeParts2)); Assert.assertFalse(client.dimPartitionExists(cubeDim.getName(), c1, timeParts)); Assert.assertFalse(client.latestPartitionExists(cubeDim.getName(), c1,
[33/50] [abbrv] lens git commit: LENS-879 : Adds Base framework for scheduler
LENS-879 : Adds Base framework for scheduler Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/7e9e47ea Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/7e9e47ea Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/7e9e47ea Branch: refs/heads/LENS-581 Commit: 7e9e47ea66109470327607fafb26045080fc969d Parents: 0e4c18c Author: Ajay YadavaAuthored: Thu Dec 10 16:28:40 2015 +0530 Committer: Amareshwari Sriramadasu Committed: Thu Dec 10 16:28:40 2015 +0530 -- .../lens/api/query/SchedulerJobHandle.java | 82 ++ .../apache/lens/api/query/SchedulerJobInfo.java | 68 + .../api/query/SchedulerJobInstanceHandle.java | 86 ++ .../api/query/SchedulerJobInstanceInfo.java | 84 ++ .../src/main/resources/scheduler-job-0.1.xsd| 283 +++ .../src/main/resources/example-job.xml | 55 .../api/scheduler/QuerySchedulerService.java| 26 -- .../server/api/scheduler/SchedulerJobStats.java | 29 ++ .../server/api/scheduler/SchedulerService.java | 238 .../lens/server/metrics/MetricsServiceImpl.java | 4 +- .../scheduler/QuerySchedulerServiceImpl.java| 55 .../server/scheduler/SchedulerServiceImpl.java | 200 + .../src/main/resources/lensserver-default.xml | 2 +- .../server/healthcheck/TestHealthChecks.java| 4 +- pom.xml | 2 +- src/site/apt/admin/config.apt | 2 +- 16 files changed, 1132 insertions(+), 88 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobHandle.java -- diff --git a/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobHandle.java b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobHandle.java new file mode 100644 index 000..aa4dc13 --- /dev/null +++ b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobHandle.java @@ -0,0 +1,82 @@ +/** + * 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.lens.api.query; + +import java.io.Serializable; +import java.util.UUID; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.commons.lang.StringUtils; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * Handle for SchedulerJob. + */ +@XmlRootElement +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@EqualsAndHashCode(callSuper = false) +public class SchedulerJobHandle implements Serializable { + + /** + * The Constant serialVersionUID. + */ + private static final long serialVersionUID = 1L; + + /** + * The handle id. + */ + @XmlElement + @Getter + private UUID handleId; + + /** + * From string. + * + * @param handle the handle for scheduler job + * @return the handle for + */ + public static SchedulerJobHandle fromString(String handle) { +return new SchedulerJobHandle(UUID.fromString(handle)); + } + + public String getHandleIdString() { +if (handleId == null) { + return StringUtils.EMPTY; +} +return handleId.toString(); + } + + /** + * String representation of the SchedulerJobHandle. + * @return string representation of the handleId + */ + @Override + public String toString() { +return getHandleIdString(); + } + +} http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInfo.java -- diff --git a/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInfo.java b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInfo.java new file mode 100644 index 000..1ae7894 --- /dev/null +++
[13/50] [abbrv] lens git commit: LENS-865: Add/delete partition throws NPE when a part col doesn't exist in the table
LENS-865: Add/delete partition throws NPE when a part col doesn't exist in the table Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/e5691d8d Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/e5691d8d Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/e5691d8d Branch: refs/heads/LENS-581 Commit: e5691d8d655c94cdd64e0d83028ec59735d73edc Parents: 09baa12 Author: Rajat KhandelwalAuthored: Tue Nov 24 12:07:17 2015 +0530 Committer: Rajat Khandelwal Committed: Tue Nov 24 12:07:17 2015 +0530 -- .../java/org/apache/lens/api/APIResult.java | 10 +- lens-api/src/main/resources/lens-errors.conf| 6 + .../lens/cube/error/LensCubeErrorCode.java | 5 +- .../lens/cube/metadata/CubeMetastoreClient.java | 42 +- .../cube/metadata/TestCubeMetastoreClient.java | 404 ++- .../lens/server/api/error/LensException.java| 8 +- .../server/metastore/MetastoreResource.java | 384 ++ .../server/metastore/TestMetastoreService.java | 40 +- 8 files changed, 498 insertions(+), 401 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/e5691d8d/lens-api/src/main/java/org/apache/lens/api/APIResult.java -- diff --git a/lens-api/src/main/java/org/apache/lens/api/APIResult.java b/lens-api/src/main/java/org/apache/lens/api/APIResult.java index 06c608a..0cdee0d 100644 --- a/lens-api/src/main/java/org/apache/lens/api/APIResult.java +++ b/lens-api/src/main/java/org/apache/lens/api/APIResult.java @@ -152,11 +152,13 @@ public class APIResult { } private static String extractCause(Throwable e) { -String cause = null; -while ((cause == null || cause.isEmpty()) && e != null) { - cause = e.getMessage(); +StringBuilder cause = new StringBuilder(); +String sep = ""; +while (e != null) { + cause.append(sep).append(e.getMessage()); e = e.getCause(); + sep = ": "; } -return cause; +return cause.toString(); } } http://git-wip-us.apache.org/repos/asf/lens/blob/e5691d8d/lens-api/src/main/resources/lens-errors.conf -- diff --git a/lens-api/src/main/resources/lens-errors.conf b/lens-api/src/main/resources/lens-errors.conf index f50433a..ca8562f 100644 --- a/lens-api/src/main/resources/lens-errors.conf +++ b/lens-api/src/main/resources/lens-errors.conf @@ -296,6 +296,12 @@ lensCubeErrorsForMetastore = [ httpStatusCode = ${BAD_REQUEST} errorMsg = "Problem in submitting entity: %s" } + + { + errorCode = 3102 + httpStatusCode = ${BAD_REQUEST} + errorMsg = "No timeline found for fact=%s, storage=%s, update period=%s, partition column=%s." + } ] lensCubeErrors = ${lensCubeErrorsForQuery}${lensCubeErrorsForMetastore} http://git-wip-us.apache.org/repos/asf/lens/blob/e5691d8d/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java b/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java index 24fb80b..6c5dc2f 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java @@ -21,6 +21,7 @@ package org.apache.lens.cube.error; import org.apache.lens.server.api.LensErrorInfo; public enum LensCubeErrorCode { + // Error codes less than 3100 are errors encountered while submitting a query // Error codes same for drivers SYNTAX_ERROR(3001, 0), FIELDS_CANNOT_BE_QUERIED_TOGETHER(3002, 0), @@ -54,7 +55,9 @@ public enum LensCubeErrorCode { NO_CANDIDATE_DIM_STORAGE_TABLES(3029, 1300), NO_STORAGE_TABLE_AVAIABLE(3030, 1400), STORAGE_UNION_DISABLED(3031, 100), - ERROR_IN_ENTITY_DEFINITION(3101, 100); + // Error codes greater than 3100 are errors while doing a metastore operation. + ERROR_IN_ENTITY_DEFINITION(3101, 100), + TIMELINE_ABSENT(3102, 100); public LensErrorInfo getLensErrorInfo() { return this.errorInfo; http://git-wip-us.apache.org/repos/asf/lens/blob/e5691d8d/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java index f945e0f..1f13617 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java +++
[47/50] [abbrv] lens git commit: LENS-552: Union support across storage tables in multi fact query
LENS-552: Union support across storage tables in multi fact query Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/04f5a822 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/04f5a822 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/04f5a822 Branch: refs/heads/LENS-581 Commit: 04f5a8223f652baa5cfbebec7f8f9a2886df5076 Parents: bf1053b Author: Rajat KhandelwalAuthored: Thu Dec 24 12:39:33 2015 +0530 Committer: Rajat Khandelwal Committed: Thu Dec 24 12:39:33 2015 +0530 -- .../lens/cube/parse/AggregateResolver.java | 12 +- .../apache/lens/cube/parse/AliasReplacer.java | 5 +- .../apache/lens/cube/parse/AutoJoinContext.java | 2 +- .../apache/lens/cube/parse/CandidateFact.java | 130 --- .../apache/lens/cube/parse/ColumnResolver.java | 2 +- .../lens/cube/parse/CubeQueryContext.java | 69 +- .../lens/cube/parse/CubeQueryRewriter.java | 2 +- .../apache/lens/cube/parse/DefaultQueryAST.java | 74 +++ .../cube/parse/DenormalizationResolver.java | 18 +-- .../apache/lens/cube/parse/DimHQLContext.java | 6 +- .../lens/cube/parse/DimOnlyHQLContext.java | 15 +-- .../lens/cube/parse/ExpressionResolver.java | 24 ++-- .../apache/lens/cube/parse/FactHQLContext.java | 65 -- .../apache/lens/cube/parse/GroupbyResolver.java | 2 - .../org/apache/lens/cube/parse/HQLParser.java | 1 - .../apache/lens/cube/parse/JoinResolver.java| 17 +-- .../lens/cube/parse/MultiFactHQLContext.java| 46 +++ .../org/apache/lens/cube/parse/QueryAST.java| 86 .../lens/cube/parse/SingleFactHQLContext.java | 96 -- .../parse/SingleFactMultiStorageHQLContext.java | 52 +--- .../SingleFactSingleStorageHQLContext.java | 85 .../lens/cube/parse/StorageTableResolver.java | 43 +++--- .../apache/lens/cube/metadata/DateFactory.java | 11 ++ .../apache/lens/cube/parse/CubeTestSetup.java | 2 +- .../lens/cube/parse/TestBaseCubeQueries.java| 24 ++-- .../lens/cube/parse/TestCubeRewriter.java | 53 ++-- 26 files changed, 481 insertions(+), 461 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/04f5a822/lens-cube/src/main/java/org/apache/lens/cube/parse/AggregateResolver.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/AggregateResolver.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/AggregateResolver.java index 39bd1cc..fd7036a 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/parse/AggregateResolver.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/AggregateResolver.java @@ -47,8 +47,6 @@ import lombok.extern.slf4j.Slf4j; */ @Slf4j class AggregateResolver implements ContextRewriter { - public AggregateResolver(Configuration conf) { - } @Override public void rewriteContext(CubeQueryContext cubeql) throws LensException { @@ -166,7 +164,7 @@ class AggregateResolver implements ContextRewriter { String colname; if (node.getToken().getType() == HiveParser.TOK_TABLE_OR_COL) { - colname = ((ASTNode) node.getChild(0)).getText(); + colname = node.getChild(0).getText(); } else { // node in 'alias.column' format ASTNode tabident = HQLParser.findNodeByPath(node, TOK_TABLE_OR_COL, Identifier); @@ -193,15 +191,9 @@ class AggregateResolver implements ContextRewriter { throw new LensException(LensCubeErrorCode.NO_DEFAULT_AGGREGATE.getLensErrorInfo(), colname); } ASTNode fnroot = new ASTNode(new CommonToken(HiveParser.TOK_FUNCTION)); -fnroot.setParent(node.getParent()); - ASTNode fnIdentNode = new ASTNode(new CommonToken(HiveParser.Identifier, aggregateFn)); -fnIdentNode.setParent(fnroot); fnroot.addChild(fnIdentNode); - -node.setParent(fnroot); fnroot.addChild(node); - return fnroot; } } else { @@ -224,7 +216,7 @@ class AggregateResolver implements ContextRewriter { String colname; if (node.getToken().getType() == HiveParser.TOK_TABLE_OR_COL) { -colname = ((ASTNode) node.getChild(0)).getText(); +colname = node.getChild(0).getText(); } else { // node in 'alias.column' format ASTNode colIdent = (ASTNode) node.getChild(1); http://git-wip-us.apache.org/repos/asf/lens/blob/04f5a822/lens-cube/src/main/java/org/apache/lens/cube/parse/AliasReplacer.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/AliasReplacer.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/AliasReplacer.java
[19/50] [abbrv] lens git commit: LENS-878 : Refactor inner classes in JoinResolver
LENS-878 : Refactor inner classes in JoinResolver Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/f7ab827e Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/f7ab827e Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/f7ab827e Branch: refs/heads/LENS-581 Commit: f7ab827e967e8a6b44cd8d540e293dbd01ff8d9b Parents: 7a3a173 Author: Amareshwari SriramadasuAuthored: Wed Nov 25 14:22:37 2015 +0530 Committer: Rajat Khandelwal Committed: Wed Nov 25 14:22:37 2015 +0530 -- .../apache/lens/cube/parse/AutoJoinContext.java | 760 ++ .../lens/cube/parse/CubeQueryContext.java | 2 +- .../org/apache/lens/cube/parse/JoinClause.java | 144 +++ .../apache/lens/cube/parse/JoinResolver.java| 982 +-- .../org/apache/lens/cube/parse/JoinTree.java| 164 .../lens/cube/parse/TimerangeResolver.java | 2 +- 6 files changed, 1076 insertions(+), 978 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/f7ab827e/lens-cube/src/main/java/org/apache/lens/cube/parse/AutoJoinContext.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/AutoJoinContext.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/AutoJoinContext.java new file mode 100644 index 000..9472506 --- /dev/null +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/AutoJoinContext.java @@ -0,0 +1,760 @@ +/** + * 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.lens.cube.parse; + +import java.util.*; + +import org.apache.lens.cube.error.LensCubeErrorCode; +import org.apache.lens.cube.metadata.*; +import org.apache.lens.server.api.error.LensException; + +import org.apache.commons.lang.StringUtils; +import org.apache.hadoop.hive.ql.parse.JoinType; + +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +/** + * Store join chain information resolved by join resolver + */ +@Slf4j +public class AutoJoinContext { + // Map of a joined table to list of all possible paths from that table to + // the target + private final Map allPaths; + @Getter + // User supplied partial join conditions + private final Map partialJoinConditions; + // True if the query contains user supplied partial join conditions + @Getter + private final boolean partialJoinChains; + @Getter + // Map of joined table to the join type (if provided by user) + private final Map tableJoinTypeMap; + + // True if joins were resolved automatically + private boolean joinsResolved; + // Target table for the auto join resolver + private final AbstractCubeTable autoJoinTarget; + // Configuration string to control join type + private String joinTypeCfg; + + // Map of a joined table to its columns which are part of any of the join + // paths. This is used in candidate table resolver + @Getter + private Map > joinPathFromColumns = +new HashMap >(); + + @Getter + private Map > joinPathToColumns = +new HashMap >(); + + // there can be separate join clause for each fact incase of multi fact queries + @Getter + Map factClauses = new HashMap (); + @Getter + @Setter + JoinClause minCostClause; + private final boolean flattenBridgeTables; + private final String bridgeTableFieldAggr; + + public AutoJoinContext(Map allPaths, + Map optionalDimensions, + Map partialJoinConditions, + boolean partialJoinChains, Map tableJoinTypeMap, + AbstractCubeTable autoJoinTarget, String
[49/50] [abbrv] lens git commit: LENS-907 : Subsequent calls to metastore API to fetch native tables throws error after the first call
LENS-907 : Subsequent calls to metastore API to fetch native tables throws error after the first call Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/4d7c8e4d Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/4d7c8e4d Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/4d7c8e4d Branch: refs/heads/LENS-581 Commit: 4d7c8e4db3e9aa81da042921a31dfd670982ce38 Parents: 7a89db1 Author: Deepak BarrAuthored: Thu Dec 24 17:14:31 2015 +0530 Committer: Deepak Kumar Barr Committed: Thu Dec 24 17:14:31 2015 +0530 -- .../apache/lens/server/metastore/CubeMetastoreServiceImpl.java | 4 1 file changed, 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/4d7c8e4d/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java -- diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java b/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java index 66ed938..cf49a13 100644 --- a/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java +++ b/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java @@ -1212,10 +1212,6 @@ public class CubeMetastoreServiceImpl extends BaseLensService implements CubeMet return result; } catch (Exception e) { throw new LensException("Error getting native tables from DB", e); -} finally { - if (null != msc) { -msc.close(); - } } }
[34/50] [abbrv] lens git commit: LENS-885: Cleanup of Cube test cases
http://git-wip-us.apache.org/repos/asf/lens/blob/7c7c86da/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java index d16ea4c..36c1dba 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java @@ -19,6 +19,7 @@ package org.apache.lens.cube.parse; +import static org.apache.lens.cube.metadata.DateFactory.*; import static org.apache.lens.cube.parse.CubeTestSetup.*; import java.util.*; @@ -55,18 +56,16 @@ public class TestDenormalizationResolver extends TestQueryRewrite { @Test public void testDenormsAsDirectFields() throws ParseException, LensException, HiveException { // denorm fields directly available -String twoDaysITRange = - "time_range_in(it, '" + CubeTestSetup.getDateUptoHours(TWODAYS_BACK) + "','" -+ CubeTestSetup.getDateUptoHours(NOW) + "')"; -String hqlQuery = rewrite("select dim2big1, max(msr3)," + " msr2 from testCube" + " where " + twoDaysITRange, conf); +String hqlQuery = rewrite("select dim2big1, max(msr3)," + " msr2 from testCube" + " where " + TWO_DAYS_RANGE_IT, + conf); String expecteddim2big1 = getExpectedQuery(cubeName, "select testcube.dim2big1," + " max(testcube.msr3), sum(testcube.msr2) FROM ", null, " group by testcube.dim2big1", getWhereForDailyAndHourly2daysWithTimeDim(cubeName, "it", "C2_summary4"), null); TestCubeRewriter.compareQueries(hqlQuery, expecteddim2big1); // with another table -hqlQuery = rewrite("select dim2big1, citydim.name, max(msr3)," + " msr2 from testCube" + " where " + twoDaysITRange, - conf); +hqlQuery = rewrite("select dim2big1, citydim.name, max(msr3)," + " msr2 from testCube" + " where " + + TWO_DAYS_RANGE_IT, conf); String expecteddim2big1WithAnotherTable = getExpectedQuery(cubeName, "select testcube.dim2big1, citydim.name, max(testcube.msr3), sum(testcube.msr2) FROM ", " JOIN " + getDbName() + "c1_citytable citydim " + "on testcube.cityid = citydim.id and citydim.dt = 'latest' ", null, @@ -75,7 +74,7 @@ public class TestDenormalizationResolver extends TestQueryRewrite { null); TestCubeRewriter.compareQueries(hqlQuery, expecteddim2big1WithAnotherTable); -hqlQuery = rewrite("select dim2big2, max(msr3)," + " msr2 from testCube" + " where " + twoDaysITRange, conf); +hqlQuery = rewrite("select dim2big2, max(msr3)," + " msr2 from testCube" + " where " + TWO_DAYS_RANGE_IT, conf); String expecteddim2big2 = getExpectedQuery(cubeName, "select testcube.dim2big2, max(testcube.msr3), sum(testcube.msr2) FROM ", null, " group by testcube.dim2big2", getWhereForDailyAndHourly2daysWithTimeDim(cubeName, "it", "C2_summary4"), @@ -84,8 +83,8 @@ public class TestDenormalizationResolver extends TestQueryRewrite { Configuration conf2 = new Configuration(conf); conf2.set(CubeQueryConfUtil.DRIVER_SUPPORTED_STORAGES, "C2"); -hqlQuery = - rewrite("select testdim3.name, dim2big1, max(msr3)," + " msr2 from testCube" + " where " + twoDaysITRange, conf2); +hqlQuery = rewrite("select testdim3.name, dim2big1, max(msr3)," + " msr2 from testCube" + " where " + + TWO_DAYS_RANGE_IT, conf2); String expected = getExpectedQuery(cubeName, "select testdim3.name, testcube.dim2big1, max(testcube.msr3), sum(testcube.msr2) FROM ", " JOIN " @@ -96,9 +95,9 @@ public class TestDenormalizationResolver extends TestQueryRewrite { null); TestCubeRewriter.compareQueries(hqlQuery, expected); -hqlQuery = rewrite("select dim2big1, max(msr3)," + " msr2 from testCube" + " where " + twoDaysITRange, conf2); +hqlQuery = rewrite("select dim2big1, max(msr3)," + " msr2 from testCube" + " where " + TWO_DAYS_RANGE_IT, conf2); TestCubeRewriter.compareQueries(hqlQuery, expecteddim2big1); -hqlQuery = rewrite("select dim2big2, max(msr3)," + " msr2 from testCube" + " where " + twoDaysITRange, conf2); +hqlQuery = rewrite("select dim2big2, max(msr3)," + " msr2 from testCube" + " where " + TWO_DAYS_RANGE_IT, conf2); TestCubeRewriter.compareQueries(hqlQuery, expecteddim2big2); } @@ -190,11 +189,8 @@ public class TestDenormalizationResolver extends TestQueryRewrite { @Test public void testCubeQueryWithExpressionHavingDenormColumnComingAsDirectColumn() throws Exception { -String twoDaysITRange = - "time_range_in(it, '" + CubeTestSetup.getDateUptoHours(TWODAYS_BACK) + "','" -+ CubeTestSetup.getDateUptoHours(NOW) + "')"; -String hqlQuery = rewrite("select substrdim2big1, max(msr3)," + " msr2 from
[05/50] [abbrv] lens git commit: LENS-826 : Updates doc for lens.client.query.poll.interval
LENS-826 : Updates doc for lens.client.query.poll.interval Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/bc865870 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/bc865870 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/bc865870 Branch: refs/heads/LENS-581 Commit: bc8658705afc7d8cd582e312278ff30b405b3dc3 Parents: 3ed191a Author: Raju BairishettiAuthored: Wed Nov 18 12:29:54 2015 +0530 Committer: Amareshwari Sriramadasu Committed: Wed Nov 18 12:29:54 2015 +0530 -- lens-client/src/main/resources/lens-client-default.xml | 5 + src/site/apt/user/client-config.apt| 10 ++ 2 files changed, 11 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/bc865870/lens-client/src/main/resources/lens-client-default.xml -- diff --git a/lens-client/src/main/resources/lens-client-default.xml b/lens-client/src/main/resources/lens-client-default.xml index d0d40c5..1b7c978 100644 --- a/lens-client/src/main/resources/lens-client-default.xml +++ b/lens-client/src/main/resources/lens-client-default.xml @@ -46,4 +46,9 @@ org.apache.lens.client.RequestFilter Implementation class for Request Filter + +lens.client.query.poll.interval +10 +Interval at which query progress will be polled. Interval has to be given in milliseconds + http://git-wip-us.apache.org/repos/asf/lens/blob/bc865870/src/site/apt/user/client-config.apt -- diff --git a/src/site/apt/user/client-config.apt b/src/site/apt/user/client-config.apt index 49bc4e2..3d990a9 100644 --- a/src/site/apt/user/client-config.apt +++ b/src/site/apt/user/client-config.apt @@ -26,12 +26,14 @@ Lens client configuration *--+--+---+--+ |1|lens.client.dbname|default|Default lens database| *--+--+---+--+ -|2|lens.client.requestfilter.ws.filter.impl|org.apache.lens.client.RequestFilter|Implementation class for Request Filter| +|2|lens.client.query.poll.interval|10|Interval at which query progress will be polled. Interval has to be given in milliseconds| *--+--+---+--+ -|3|lens.client.user.name|anonymous|Lens client user name| +|3|lens.client.requestfilter.ws.filter.impl|org.apache.lens.client.RequestFilter|Implementation class for Request Filter| *--+--+---+--+ -|4|lens.client.ws.request.filternames|requestfilter|These JAX-RS filters would be started in the specified order when lens-client starts| +|4|lens.client.user.name|anonymous|Lens client user name| *--+--+---+--+ -|5|lens.server.base.url|http://0.0.0.0:/lensapi|The base url for the lens server| +|5|lens.client.ws.request.filternames|requestfilter|These JAX-RS filters would be started in the specified order when lens-client starts| +*--+--+---+--+ +|6|lens.server.base.url|http://0.0.0.0:/lensapi|The base url for the lens server| *--+--+---+--+ The configuration parameters and their default values
[11/50] [abbrv] lens git commit: LENS-870 : Expressions in multi fact query is not rewritten properly
LENS-870 : Expressions in multi fact query is not rewritten properly Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/09baa128 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/09baa128 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/09baa128 Branch: refs/heads/LENS-581 Commit: 09baa12880ba27c00323bbf881e9c69acb580117 Parents: d820c32 Author: Sushil MohantyAuthored: Tue Nov 24 12:05:05 2015 +0530 Committer: Rajat Khandelwal Committed: Tue Nov 24 12:05:05 2015 +0530 -- .../lens/cube/parse/CandidateTableResolver.java | 3 ++- .../lens/cube/parse/ExpressionResolver.java | 6 ++--- .../apache/lens/cube/parse/CubeTestSetup.java | 2 ++ .../lens/cube/parse/TestBaseCubeQueries.java| 27 4 files changed, 34 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/09baa128/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTableResolver.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTableResolver.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTableResolver.java index 0ad7610..38ff5a4 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTableResolver.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTableResolver.java @@ -272,7 +272,8 @@ class CandidateTableResolver implements ContextRewriter { if (!checkForColumnExists(cfact, queriedMsrs) && (cubeql.getQueriedExprsWithMeasures().isEmpty() || cubeql.getExprCtx().allNotEvaluable(cubeql.getQueriedExprsWithMeasures(), cfact))) { - log.info("Not considering fact table:{} as columns {} is not available", cfact, queriedMsrs); + log.info("Not considering fact table:{} as columns {},{} is not available", cfact, queriedMsrs, + cubeql.getQueriedExprsWithMeasures()); cubeql.addFactPruningMsgs(cfact.fact, CandidateTablePruneCause.columnNotFound(queriedMsrs, cubeql.getQueriedExprsWithMeasures())); toRemove = true; http://git-wip-us.apache.org/repos/asf/lens/blob/09baa128/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java index 1a347b2..200a48c 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java @@ -405,11 +405,11 @@ class ExpressionResolver implements ContextRewriter { */ public boolean allNotEvaluable(Set exprs, CandidateTable cTable) { for (String expr : exprs) { -if (!isEvaluable(expr, cTable)) { - return true; +if (isEvaluable(expr, cTable)) { + return false; } } - return false; + return true; } public Collection coveringExpressions(Set exprs, CandidateTable cTable) { http://git-wip-us.apache.org/repos/asf/lens/blob/09baa128/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java index aa15a2c..999faa0 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java @@ -732,6 +732,8 @@ public class CubeTestSetup { "round(msr1/1000)")); exprs.add(new ExprColumn(new FieldSchema("roundedmsr2", "double", "rounded measure2"), "Rounded msr2", "round(msr2/1000)")); +exprs.add(new ExprColumn(new FieldSchema("flooredmsr12", "double", "floored measure12"), "Floored msr12", +"floor(msr12)")); exprs.add(new ExprColumn(new FieldSchema("nestedexpr", "double", "nested expr"), "Nested expr", new ExprSpec("avg(roundedmsr2)", null, null), new ExprSpec("avg(equalsums)", null, null), new ExprSpec("case when substrexpr = 'xyz' then avg(msr5) when substrexpr = 'abc' then avg(msr4)/100 end", http://git-wip-us.apache.org/repos/asf/lens/blob/09baa128/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBaseCubeQueries.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBaseCubeQueries.java
[01/50] [abbrv] lens git commit: LENS-858 : No cubes are shown in front end.
Repository: lens Updated Branches: refs/heads/LENS-581 5052e2a24 -> 25a17dfc9 LENS-858 : No cubes are shown in front end. Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/ffc9987e Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/ffc9987e Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/ffc9987e Branch: refs/heads/LENS-581 Commit: ffc9987ec7ad24383348750a63dc79ffe4e4c7ff Parents: 6409042 Author: Ankeet MainiAuthored: Mon Nov 9 16:27:43 2015 +0530 Committer: Deepak Kumar Barr Committed: Mon Nov 9 16:27:43 2015 +0530 -- lens-ui/app/components/CubeTreeComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/ffc9987e/lens-ui/app/components/CubeTreeComponent.js -- diff --git a/lens-ui/app/components/CubeTreeComponent.js b/lens-ui/app/components/CubeTreeComponent.js index e348898..e288476 100644 --- a/lens-ui/app/components/CubeTreeComponent.js +++ b/lens-ui/app/components/CubeTreeComponent.js @@ -122,7 +122,7 @@ class CubeTree extends React.Component { if (this.state.loading) { cubeTree = ; -} else if (!this.state.cubes.length) { +} else if (!Object.keys(this.state.cubes).length) { cubeTree = ( Sorry, we couldnt find any cubes. );
[37/50] [abbrv] lens git commit: LENS-885: Cleanup of Cube test cases
LENS-885: Cleanup of Cube test cases Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/7c7c86da Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/7c7c86da Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/7c7c86da Branch: refs/heads/LENS-581 Commit: 7c7c86daed2e9907bda92f5ed29e73ed99a9a726 Parents: 7e9e47e Author: Rajat KhandelwalAuthored: Fri Dec 11 18:40:59 2015 +0530 Committer: Rajat Khandelwal Committed: Fri Dec 11 18:41:00 2015 +0530 -- .../apache/lens/cube/metadata/CubeColumn.java | 1 - .../lens/cube/metadata/CubeFactTable.java | 1 - .../org/apache/lens/cube/metadata/DateUtil.java | 396 .../lens/cube/metadata/TimePartitionRange.java | 1 - .../apache/lens/cube/metadata/TimeRange.java| 219 + .../apache/lens/cube/metadata/UpdatePeriod.java | 84 +++- .../timeline/EndsAndHolesPartitionTimeline.java | 2 +- .../apache/lens/cube/parse/CandidateFact.java | 5 +- .../cube/parse/CandidateTablePruneCause.java| 2 + .../org/apache/lens/cube/parse/DateUtil.java| 456 -- .../lens/cube/parse/ExpressionResolver.java | 11 +- .../lens/cube/parse/SingleFactHQLContext.java | 2 +- .../lens/cube/parse/StorageTableResolver.java | 2 +- .../org/apache/lens/cube/parse/TimeRange.java | 220 - .../lens/cube/parse/TimerangeResolver.java | 5 +- .../lens/cube/metadata/CubeFactTableTest.java | 1 - .../apache/lens/cube/metadata/DateFactory.java | 196 .../cube/metadata/TestCubeMetastoreClient.java | 115 ++--- .../apache/lens/cube/metadata/TestDateUtil.java | 297 .../apache/lens/cube/parse/CubeTestSetup.java | 191 ++-- .../FieldsCannotBeQueriedTogetherTest.java | 8 +- .../lens/cube/parse/TestAggregateResolver.java | 1 + .../lens/cube/parse/TestBaseCubeQueries.java| 5 +- .../cube/parse/TestBetweenTimeRangeWriter.java | 25 +- .../lens/cube/parse/TestCubeRewriter.java | 459 +-- .../apache/lens/cube/parse/TestDateUtil.java| 299 .../cube/parse/TestDenormalizationResolver.java | 28 +- .../lens/cube/parse/TestExpressionContext.java | 4 +- .../lens/cube/parse/TestExpressionResolver.java | 1 + .../lens/cube/parse/TestJoinResolver.java | 1 + .../lens/cube/parse/TestORTimeRangeWriter.java | 40 +- .../lens/cube/parse/TestQueryMetrics.java | 2 +- .../lens/cube/parse/TestRewriterPlan.java | 2 +- .../apache/lens/cube/parse/TestStorageUtil.java | 98 ++-- .../lens/cube/parse/TestTimeRangeExtractor.java | 33 +- .../lens/cube/parse/TestTimeRangeResolver.java | 2 +- .../lens/cube/parse/TestTimeRangeWriter.java| 48 +- .../parse/TestTimeRangeWriterWithQuery.java | 134 +++--- .../lens/server/query/QueryResultPurger.java| 2 +- 39 files changed, 1693 insertions(+), 1706 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/7c7c86da/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeColumn.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeColumn.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeColumn.java index a2a00d2..b04532f 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeColumn.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeColumn.java @@ -24,7 +24,6 @@ import java.util.Date; import java.util.Map; import java.util.TimeZone; -import org.apache.lens.cube.parse.TimeRange; import com.google.common.base.Optional; http://git-wip-us.apache.org/repos/asf/lens/blob/7c7c86da/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java index d6bfb79..dd0adb7 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java @@ -21,7 +21,6 @@ package org.apache.lens.cube.metadata; import java.util.*; import org.apache.lens.cube.metadata.UpdatePeriod.UpdatePeriodComparator; -import org.apache.lens.cube.parse.DateUtil; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.hive.metastore.api.FieldSchema; http://git-wip-us.apache.org/repos/asf/lens/blob/7c7c86da/lens-cube/src/main/java/org/apache/lens/cube/metadata/DateUtil.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/DateUtil.java
[30/50] [abbrv] lens git commit: LENS-891 : Fix Weekly covering info for last Sunday of year and first Sunday of next year
LENS-891 : Fix Weekly covering info for last Sunday of year and first Sunday of next year Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/b63e06c0 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/b63e06c0 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/b63e06c0 Branch: refs/heads/LENS-581 Commit: b63e06c0cdec67ffb6dc5f14d89f7d10091ef2d5 Parents: b3b7e5f Author: Rajat KhandelwalAuthored: Thu Dec 10 11:06:52 2015 +0530 Committer: Amareshwari Sriramadasu Committed: Thu Dec 10 11:06:52 2015 +0530 -- .../src/main/java/org/apache/lens/cube/parse/DateUtil.java | 9 + .../test/java/org/apache/lens/cube/parse/TestDateUtil.java | 4 2 files changed, 5 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/b63e06c0/lens-cube/src/main/java/org/apache/lens/cube/parse/DateUtil.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/DateUtil.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/DateUtil.java index 5e17eac..cd05c68 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/parse/DateUtil.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/DateUtil.java @@ -343,20 +343,13 @@ public final class DateUtil { Calendar cal = Calendar.getInstance(); cal.setTime(from); -int fromWeek = cal.get(Calendar.WEEK_OF_YEAR); int fromDay = cal.get(Calendar.DAY_OF_WEEK); -int fromYear = cal.get(YEAR); - -cal.clear(); -cal.set(YEAR, fromYear); -cal.set(Calendar.WEEK_OF_YEAR, fromWeek); cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); -int maxDayInWeek = cal.getActualMaximum(Calendar.DAY_OF_WEEK); Date fromWeekStartDate = cal.getTime(); boolean coverable = dayDiff % 7 == 0; if (fromWeekStartDate.before(from)) { // Count from the start of next week - dayDiff -= (maxDayInWeek - (fromDay - Calendar.SUNDAY)); + dayDiff -= (cal.getActualMaximum(Calendar.DAY_OF_WEEK) - (fromDay - Calendar.SUNDAY)); coverable = false; } http://git-wip-us.apache.org/repos/asf/lens/blob/b63e06c0/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDateUtil.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDateUtil.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDateUtil.java index ab88fbe..ff9a96d 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDateUtil.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDateUtil.java @@ -76,6 +76,7 @@ public class TestDateUtil { } } + @Test public void testMonthsBetween() throws Exception { int i = 0; @@ -194,6 +195,9 @@ public class TestDateUtil { weeks = getWeeklyCoveringInfo(DATE_FMT.parse("2013-May-26"), DATE_FMT.parse("2013-Jun-10")); assertEquals(weeks, new CoveringInfo(2, false), "2013-May-26 to 2013-Jun-10"); + +weeks = getWeeklyCoveringInfo(DATE_FMT.parse("2015-Dec-27"), DATE_FMT.parse("2016-Jan-03")); +assertEquals(weeks, new CoveringInfo(1, true), "2015-Dec-27 to 2016-Jan-03"); } @Test
[20/50] [abbrv] lens git commit: LENS-871 : Fix Dropping any partition in dimtable is clearing latest cache for that dimtable.
http://git-wip-us.apache.org/repos/asf/lens/blob/87049563/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestFactPartition.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestFactPartition.java b/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestFactPartition.java index 3f2ae6f..e802c3c 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestFactPartition.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestFactPartition.java @@ -39,8 +39,8 @@ public class TestFactPartition { @Test public void testGetFormattedFilter() throws Exception { -String dailyFormat = DAILY.format().format(DATE); -String hourlyFormat = HOURLY.format().format(DATE); +String dailyFormat = DAILY.format(DATE); +String hourlyFormat = HOURLY.format(DATE); assertEquals(fp1.getFormattedFilter("table"), "table.p = '" + dailyFormat + "'"); assertEquals(fp2.getFormattedFilter("table2"), "table2.p = '" + dailyFormat + "' AND table2.q = '" + hourlyFormat + "'"); http://git-wip-us.apache.org/repos/asf/lens/blob/87049563/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestTimePartition.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestTimePartition.java b/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestTimePartition.java index 2cbbd0c..729bcab 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestTimePartition.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestTimePartition.java @@ -39,7 +39,7 @@ public class TestTimePartition { @Test(dataProvider = "update-periods") public void test(UpdatePeriod up) throws LensException { // Normal date object parsable -String nowStr = up.format().format(NOW); +String nowStr = up.format(NOW); // Create partition by date object or it's string representation -- both should be same. TimePartition nowPartition = TimePartition.of(up, NOW); TimePartition nowStrPartition = TimePartition.of(up, nowStr); http://git-wip-us.apache.org/repos/asf/lens/blob/87049563/lens-cube/src/test/java/org/apache/lens/cube/metadata/UpdatePeriodTest.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/metadata/UpdatePeriodTest.java b/lens-cube/src/test/java/org/apache/lens/cube/metadata/UpdatePeriodTest.java index b21341d..b7ee8cc 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/metadata/UpdatePeriodTest.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/metadata/UpdatePeriodTest.java @@ -54,7 +54,7 @@ public class UpdatePeriodTest { for (int i = 0; i < 5000; i++) { Date randomDate = randomDateGenerator.nextDate(); randomDate = period.truncate(randomDate); - assertEquals(randomDate, period.format().parse(period.format().format(randomDate))); + assertEquals(randomDate, period.parse(period.format(randomDate))); } } } http://git-wip-us.apache.org/repos/asf/lens/blob/87049563/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java index 999faa0..1357035 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java @@ -19,15 +19,11 @@ package org.apache.lens.cube.parse; -import static java.util.Calendar.DAY_OF_MONTH; -import static java.util.Calendar.HOUR_OF_DAY; -import static java.util.Calendar.MONTH; +import static java.util.Calendar.*; import static org.apache.lens.cube.metadata.UpdatePeriod.*; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; +import static org.testng.Assert.*; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -58,7 +54,6 @@ import org.apache.hadoop.mapred.TextInputFormat; import com.google.common.collect.Lists; import com.google.common.collect.Maps; - import com.google.common.collect.Sets; import lombok.Getter; import lombok.extern.slf4j.Slf4j; @@ -105,7 +100,6 @@ public class CubeTestSetup { public static final String DERIVED_CUBE_NAME1 = "der1"; public static final String DERIVED_CUBE_NAME2 = "der2"; public static final String DERIVED_CUBE_NAME3 = "der3"; - public static final String DERIVED_CUBE_NAME4 = "der4"; // Time Instances as Date Type public static final Date NOW; @@ -140,9 +134,31 @@ public class CubeTestSetup { private static MapfactValidityProperties = Maps.newHashMap(); @Getter private static
[06/50] [abbrv] lens git commit: LENS-828 : Adds validation for derived cube creation
LENS-828 : Adds validation for derived cube creation Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/7b5f4a09 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/7b5f4a09 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/7b5f4a09 Branch: refs/heads/LENS-581 Commit: 7b5f4a09a9471fdedc25e955cc4fd6990e89f1ef Parents: bc86587 Author: Rajat KhandelwalAuthored: Wed Nov 18 13:55:59 2015 +0530 Committer: Amareshwari Sriramadasu Committed: Wed Nov 18 13:55:59 2015 +0530 -- lens-api/src/main/resources/lens-errors.conf| 12 +- .../lens/cube/error/LensCubeErrorCode.java | 3 +- .../org/apache/lens/cube/metadata/Cube.java | 10 ++--- .../lens/cube/metadata/CubeMetastoreClient.java | 2 +- .../apache/lens/cube/metadata/DerivedCube.java | 43 ++-- .../cube/metadata/TestCubeMetastoreClient.java | 8 ++-- .../apache/lens/cube/parse/CubeTestSetup.java | 17 ++-- .../metastore/CubeMetastoreServiceImpl.java | 13 +- .../apache/lens/server/metastore/JAXBUtils.java | 30 +++--- .../server/metastore/TestMetastoreService.java | 36 10 files changed, 120 insertions(+), 54 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/7b5f4a09/lens-api/src/main/resources/lens-errors.conf -- diff --git a/lens-api/src/main/resources/lens-errors.conf b/lens-api/src/main/resources/lens-errors.conf index a582dc2..7526456 100644 --- a/lens-api/src/main/resources/lens-errors.conf +++ b/lens-api/src/main/resources/lens-errors.conf @@ -99,7 +99,7 @@ lensServerErrors = [ # lensCubeErrors: Defined for lens-cube module -lensCubeErrors = [ +lensCubeErrorsForQuery = [ { errorCode = 3001 @@ -284,6 +284,16 @@ lensCubeErrors = [ } ] +lensCubeErrorsForMetastore = [ + { +errorCode = 3101 +httpStatusCode = ${BAD_REQUEST} +errorMsg = "Problem in submitting entity: %s" + } +] + +lensCubeErrors = ${lensCubeErrorsForQuery}${lensCubeErrorsForMetastore} + # Overriding errors in lens-errors.conf via lens-errors-override.conf: # # Step 1: Copy contents of lens-errors.conf to lens-errors-override.conf http://git-wip-us.apache.org/repos/asf/lens/blob/7b5f4a09/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java b/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java index 73a584f..2119b64 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java @@ -52,7 +52,8 @@ public enum LensCubeErrorCode { NO_CANDIDATE_DIM_AVAILABLE(3027, 1100), NO_CANDIDATE_FACT_AVAILABLE(3028, 1200), NO_CANDIDATE_DIM_STORAGE_TABLES(3029, 1300), - NO_STORAGE_TABLE_AVAIABLE(3030, 1400); + NO_STORAGE_TABLE_AVAIABLE(3030, 1400), + ERROR_IN_ENTITY_DEFINITION(3101, 100); public LensErrorInfo getLensErrorInfo() { return this.errorInfo; http://git-wip-us.apache.org/repos/asf/lens/blob/7b5f4a09/lens-cube/src/main/java/org/apache/lens/cube/metadata/Cube.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/Cube.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/Cube.java index 98fb92e..f09da37 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/Cube.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/Cube.java @@ -205,19 +205,19 @@ public class Cube extends AbstractBaseTable implements CubeInterface { } public CubeDimAttribute getDimAttributeByName(String dimension) { -return dimMap.get(dimension == null ? dimension : dimension.toLowerCase()); +return dimMap.get(dimension == null ? null : dimension.toLowerCase()); } public CubeMeasure getMeasureByName(String measure) { -return measureMap.get(measure == null ? measure : measure.toLowerCase()); +return measureMap.get(measure == null ? null : measure.toLowerCase()); } public CubeColumn getColumnByName(String column) { -CubeColumn cubeCol = (CubeColumn) super.getExpressionByName(column); +CubeColumn cubeCol = super.getExpressionByName(column); if (cubeCol == null) { - cubeCol = (CubeColumn) getMeasureByName(column); + cubeCol = getMeasureByName(column); if (cubeCol == null) { -cubeCol = (CubeColumn) getDimAttributeByName(column); +cubeCol = getDimAttributeByName(column); } } return cubeCol;
[02/50] [abbrv] lens git commit: LENS-862: Update HQLParser.printAST() to print Char Position In Line
LENS-862: Update HQLParser.printAST() to print Char Position In Line Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/be36b630 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/be36b630 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/be36b630 Branch: refs/heads/LENS-581 Commit: be36b63034d8ba62ed491e92a53fa40fd0896e4e Parents: ffc9987 Author: Puneet GuptaAuthored: Mon Nov 16 11:39:04 2015 +0530 Committer: Rajat Khandelwal Committed: Mon Nov 16 11:39:04 2015 +0530 -- lens-cube/src/main/java/org/apache/lens/cube/parse/HQLParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/be36b630/lens-cube/src/main/java/org/apache/lens/cube/parse/HQLParser.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/HQLParser.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/HQLParser.java index ea9badd..16e1aa3 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/parse/HQLParser.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/HQLParser.java @@ -194,7 +194,7 @@ public final class HQLParser { } System.out.print(node.getText() + " [" + tokenMapping.get(node.getToken().getType()) + "]"); -System.out.print(" (l" + level + "c" + child + ")"); +System.out.print(" (l" + level + "c" + child + "p" + node.getCharPositionInLine() +")"); if (node.getChildCount() > 0) { System.out.println(" {");
[08/50] [abbrv] lens git commit: LENS-851 : queries where results of two storage tables of same fact are unioned, the rows should be aggregated
http://git-wip-us.apache.org/repos/asf/lens/blob/c445730c/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java index 8e35ea9..db3ba9b 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java @@ -19,22 +19,28 @@ package org.apache.lens.cube.parse; +import static org.apache.lens.cube.parse.HQLParser.equalsAST; + import java.util.Map; import java.util.Set; +import org.apache.lens.server.api.error.LensException; + import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.ql.parse.ASTNode; import com.google.common.base.Objects; import com.google.common.collect.Maps; import com.google.common.collect.Sets; - -import lombok.Getter; -import lombok.Setter; - +import lombok.Data; import lombok.extern.slf4j.Slf4j; @Slf4j public class TestQuery { + private static HiveConf conf = new HiveConf(); + private ASTNode ast; private String actualQuery; private String joinQueryPart = null; @@ -46,6 +52,7 @@ public class TestQuery { private String preJoinQueryPart = null; private String postJoinQueryPart = null; + private boolean processed = false; public enum JoinType { INNERJOIN, @@ -54,32 +61,45 @@ public class TestQuery { FULLOUTERJOIN, UNIQUE, LEFTSEMIJOIN, -JOIN; +JOIN } public enum Clause { WHERE, GROUPBY, HAVING, -ORDEREDBY; +ORDEREDBY } public TestQuery(String query) { this.actualQuery = query; -this.trimmedQuery = getTrimmedQuery(query); -this.joinQueryPart = extractJoinStringFromQuery(trimmedQuery); -/** - * Get the join query part, pre-join query and post-join query part from the trimmed query. - * - */ -if (StringUtils.isNotBlank(joinQueryPart)) { - this.preJoinQueryPart = trimmedQuery.substring(0, trimmedQuery.indexOf(joinQueryPart)); - this.postJoinQueryPart = trimmedQuery.substring(getMinIndexOfClause()); - prepareJoinStrings(trimmedQuery); -} else { - int minIndex = getMinIndexOfClause(); - this.preJoinQueryPart = trimmedQuery.substring(0, minIndex); - this.postJoinQueryPart = trimmedQuery.substring(minIndex); + } + + public ASTNode getAST() throws LensException { +if (this.ast == null) { + ast = HQLParser.parseHQL(this.actualQuery, conf); +} +return ast; + } + + public void processQueryAsString() { +if (!processed) { + processed = true; + this.trimmedQuery = getTrimmedQuery(actualQuery); + this.joinQueryPart = extractJoinStringFromQuery(trimmedQuery); + /** + * Get the join query part, pre-join query and post-join query part from the trimmed query. + * + */ + if (StringUtils.isNotBlank(joinQueryPart)) { +this.preJoinQueryPart = trimmedQuery.substring(0, trimmedQuery.indexOf(joinQueryPart)); +this.postJoinQueryPart = trimmedQuery.substring(getMinIndexOfClause()); +prepareJoinStrings(trimmedQuery); + } else { +int minIndex = getMinIndexOfClause(); +this.preJoinQueryPart = trimmedQuery.substring(0, minIndex); +this.postJoinQueryPart = trimmedQuery.substring(minIndex); + } } } @@ -105,11 +125,11 @@ public class TestQuery { query = query.substring(nextJoinIndex + joinDetails.getJoinType().name().length()); } } - + @Data private class JoinDetails { -@Setter @Getter private JoinType joinType; -@Setter @Getter private int index; -@Setter @Getter private String joinString; +private JoinType joinType; +private int index; +private String joinString; } /** @@ -129,7 +149,7 @@ public class TestQuery { joinDetails.setIndex(nextJoinIndex); if (nextJoinIndex != Integer.MAX_VALUE) { joinDetails.setJoinString( - getJoinString(query.substring(nextJoinIndex + nextJoinTypePart.name().length(; +getJoinString(query.substring(nextJoinIndex + nextJoinTypePart.name().length(; } joinDetails.setJoinType(nextJoinTypePart); return joinDetails; @@ -164,7 +184,7 @@ public class TestQuery { } minClauseIndex = clauseIndex < minClauseIndex ? clauseIndex : minClauseIndex; } -return (minClauseIndex == Integer.MAX_VALUE || minClauseIndex == -1) ? query.length() : minClauseIndex; +return (minClauseIndex == Integer.MAX_VALUE) ? query.length() : minClauseIndex; } private int getMinIndexOfJoinType() { @@ -190,6 +210,9 @@ public class TestQuery { @Override public boolean equals(Object query) { +if (!(query instanceof TestQuery)) { + return
[16/50] [abbrv] lens git commit: LEN-873: Merge release branch into master
LEN-873: Merge release branch into master Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/73716cb6 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/73716cb6 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/73716cb6 Branch: refs/heads/LENS-581 Commit: 73716cb6fee54811c1e7c942d52e4636cc49606b Parents: b66592c Author: Raju BairishettiAuthored: Wed Nov 25 08:22:17 2015 +0800 Committer: Raju Bairishetti Committed: Wed Nov 25 08:22:17 2015 +0800 -- .../lens/cube/parse/TestCubeRewriter.java | 2 ++ .../org/apache/lens/cube/parse/TestQuery.java | 1 + .../driver/jdbc/TestColumnarSQLRewriter.java| 2 -- lens-regression/pom.xml | 13 + lens-ship-jars/pom.xml | 4 +-- src/site/apt/releases/download.apt | 2 +- src/site/apt/releases/release-history.apt | 28 7 files changed, 40 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/73716cb6/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java index 04b7ab1..fea70b7 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java @@ -39,6 +39,7 @@ import org.apache.lens.cube.parse.CandidateTablePruneCause.SkipStorageCode; import org.apache.lens.server.api.error.LensException; import org.apache.commons.lang.time.DateUtils; + import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.FieldSchema; @@ -54,6 +55,7 @@ import com.google.common.base.Splitter; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Sets; + import lombok.extern.slf4j.Slf4j; @Slf4j http://git-wip-us.apache.org/repos/asf/lens/blob/73716cb6/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java index db3ba9b..cd20fef 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQuery.java @@ -34,6 +34,7 @@ import org.apache.hadoop.hive.ql.parse.ASTNode; import com.google.common.base.Objects; import com.google.common.collect.Maps; import com.google.common.collect.Sets; + import lombok.Data; import lombok.extern.slf4j.Slf4j; http://git-wip-us.apache.org/repos/asf/lens/blob/73716cb6/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestColumnarSQLRewriter.java -- diff --git a/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestColumnarSQLRewriter.java b/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestColumnarSQLRewriter.java index 7772d16..cf795fa 100644 --- a/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestColumnarSQLRewriter.java +++ b/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestColumnarSQLRewriter.java @@ -629,7 +629,6 @@ public class TestColumnarSQLRewriter { + "( time_dim___time_dim . day ), ( item_dim___item_dim . item_key ) " + "order by dollars_sold desc"; compareQueries(actual, expected); - } @Test @@ -683,7 +682,6 @@ public class TestColumnarSQLRewriter { + " ( time_dim___time_dim . day ), ( item_dim___item_dim . item_key ) " + "order by dollars_sold desc"; compareQueries(actual, expected); - } @Test http://git-wip-us.apache.org/repos/asf/lens/blob/73716cb6/lens-regression/pom.xml -- diff --git a/lens-regression/pom.xml b/lens-regression/pom.xml index 8555e36..807d3b2 100644 --- a/lens-regression/pom.xml +++ b/lens-regression/pom.xml @@ -87,14 +87,13 @@ - - - - - + + + + + -
[32/50] [abbrv] lens git commit: LENS-882: Provide option from CLI to list queries by driver
LENS-882: Provide option from CLI to list queries by driver Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/0e4c18cb Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/0e4c18cb Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/0e4c18cb Branch: refs/heads/LENS-581 Commit: 0e4c18cb917015b469ca43d30d7e2196d8f64789 Parents: 22e2022 Author: Deepak BarrAuthored: Thu Dec 10 12:16:11 2015 +0530 Committer: Rajat Khandelwal Committed: Thu Dec 10 12:16:11 2015 +0530 -- .../lens/cli/commands/LensQueryCommands.java| 4 ++- .../apache/lens/cli/TestLensQueryCommands.java | 26 +--- .../java/org/apache/lens/client/LensClient.java | 5 ++-- .../org/apache/lens/client/LensStatement.java | 6 +++-- src/site/apt/user/cli.apt | 2 +- 5 files changed, 28 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/0e4c18cb/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java -- diff --git a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java index fe9b84d..e3c08ff 100644 --- a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java +++ b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java @@ -218,6 +218,7 @@ public class LensQueryCommands extends BaseLensCommand { * @param state the state * @param queryName the query name * @param user the user + * @param driverthe driver name * @param fromDate the from date * @param toDatethe to date * @return the all queries @@ -229,11 +230,12 @@ public class LensQueryCommands extends BaseLensCommand { @CliOption(key = {"state"}, mandatory = false, help = "") String state, @CliOption(key = {"name"}, mandatory = false, help = "") String queryName, @CliOption(key = {"user"}, mandatory = false, help = "") String user, +@CliOption(key = {"driver"}, mandatory = false, help = "") String driver, @CliOption(key = {"fromDate"}, mandatory = false, unspecifiedDefaultValue = "-1", help = "") long fromDate, @CliOption(key = {"toDate"}, mandatory = false, unspecifiedDefaultValue = "" + Long.MAX_VALUE, help = "") long toDate) { -List handles = getClient().getQueries(state, queryName, user, fromDate, toDate); +List handles = getClient().getQueries(state, queryName, user, driver, fromDate, toDate); if (handles != null && !handles.isEmpty()) { return Joiner.on("\n").skipNulls().join(handles).concat("\n").concat("Total number of queries: " + handles.size()); http://git-wip-us.apache.org/repos/asf/lens/blob/0e4c18cb/lens-cli/src/test/java/org/apache/lens/cli/TestLensQueryCommands.java -- diff --git a/lens-cli/src/test/java/org/apache/lens/cli/TestLensQueryCommands.java b/lens-cli/src/test/java/org/apache/lens/cli/TestLensQueryCommands.java index 48b3ebb..6ebfff7 100644 --- a/lens-cli/src/test/java/org/apache/lens/cli/TestLensQueryCommands.java +++ b/lens-cli/src/test/java/org/apache/lens/cli/TestLensQueryCommands.java @@ -230,7 +230,7 @@ public class TestLensQueryCommands extends LensCliApplicationTest { String qh = qCom.executeQuery(sql, true, "testQuery1"); String user = qCom.getClient().getLensStatement(new QueryHandle(UUID.fromString(qh))) .getQuery().getSubmittedUser(); -String result = qCom.getAllQueries("", "testQuery1", user, -1, Long.MAX_VALUE); +String result = qCom.getAllQueries("", "testQuery1", user, "", -1, Long.MAX_VALUE); // this is because previous query has run two query handle will be there assertTrue(result.contains(qh), result); assertTrue(result.contains("Total number of queries")); @@ -249,7 +249,7 @@ public class TestLensQueryCommands extends LensCliApplicationTest { } // Check that query name searching is 'ilike' -String result2 = qCom.getAllQueries("", "query", "all", -1, Long.MAX_VALUE); +String result2 = qCom.getAllQueries("", "query", "all", "", -1, Long.MAX_VALUE); assertTrue(result2.contains(qh), result2); assertTrue(qCom.getStatus(qh).contains("Status : SUCCESSFUL")); @@ -265,10 +265,10 @@ public class TestLensQueryCommands extends LensCliApplicationTest { // Kill query is not tested as there is no deterministic way of killing a query -result = qCom.getAllQueries("SUCCESSFUL", "", "all", -1, Long.MAX_VALUE); +result = qCom.getAllQueries("SUCCESSFUL", "", "all", "", -1, Long.MAX_VALUE); assertTrue(result.contains(qh),
[07/50] [abbrv] lens git commit: LENS-864: LENS - 864
LENS-864: LENS - 864 Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/2870be7c Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/2870be7c Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/2870be7c Branch: refs/heads/LENS-581 Commit: 2870be7c8c2dbef92c237878c5faba048d3a139d Parents: 7b5f4a0 Author: Ankeet MainiAuthored: Wed Nov 18 17:58:45 2015 +0530 Committer: Rajat Khandelwal Committed: Wed Nov 18 17:58:45 2015 +0530 -- lens-ui/app/components/QueryBoxComponent.js | 122 +++-- .../app/components/QueryParamRowComponent.js| 176 +-- lens-ui/app/components/QueryParamsComponent.js | 72 +--- .../components/SavedQueryPreviewComponent.js| 26 +-- 4 files changed, 219 insertions(+), 177 deletions(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/2870be7c/lens-ui/app/components/QueryBoxComponent.js -- diff --git a/lens-ui/app/components/QueryBoxComponent.js b/lens-ui/app/components/QueryBoxComponent.js index 6f4eeb7..ec6a06b 100644 --- a/lens-ui/app/components/QueryBoxComponent.js +++ b/lens-ui/app/components/QueryBoxComponent.js @@ -21,6 +21,7 @@ import React from 'react'; import ClassNames from 'classnames'; import CodeMirror from 'codemirror'; import assign from 'object-assign'; +import _ from 'lodash'; import 'codemirror/lib/codemirror.css'; import 'codemirror/addon/edit/matchbrackets.js'; import 'codemirror/addon/hint/sql-hint.js'; @@ -74,6 +75,20 @@ function setCode (code) { } } +function getEmptyState () { + return { +clientMessage: null, // to give user instant ack +isRunQueryDisabled: true, +serverMessage: null, // type (success or error), text as keys +isCollapsed: false, +params: null, +isModeEdit: false, +savedQueryId: null, +runImmediately: false, +description: '' + }; +} + // used to populate the query box when user wants to edit a query // TODO improve this. // this takes in the query handle and writes the query @@ -114,16 +129,7 @@ class QueryBox extends React.Component { this.saveOrUpdate = this.saveOrUpdate.bind(this); this.runSavedQuery = this.runSavedQuery.bind(this); -this.state = { - clientMessage: null, // to give user instant ack - isRunQueryDisabled: true, - serverMessage: null, // type (success or error), text as keys - isCollapsed: false, - params: null, - isModeEdit: false, - savedQueryId: null, - runImmediately: false -}; +this.state = getEmptyState(); } componentDidMount () { @@ -184,6 +190,7 @@ class QueryBox extends React.Component { this.setState({ params: savedQuery.parameters, savedQueryId: savedQuery.id, + description: savedQuery.description, isModeEdit: true }); } @@ -257,7 +264,7 @@ class QueryBox extends React.Component { { this.state.params && !!this.state.params.length && +saveParams={this.saveParams} description={this.state.description}/> } { this.state.serverMessage && @@ -304,17 +311,40 @@ class QueryBox extends React.Component { updateQuery (params) { let query = this._getSavedQueryDetails(params); if (!query) return; + +var options = { + parameters: query.parameters, + description: query.description, + name: query.name +}; + AdhocQueryActions - .updateSavedQuery(query.secretToken, query.user, query.query, query.params, this.state.savedQueryId); -this.setState({ clientMessage: clientMessages.updateQuery }); + .updateSavedQuery(query.secretToken, query.user, query.query, +options, this.state.savedQueryId); + +this.setState({ + clientMessage: clientMessages.updateQuery, + runImmediately: params && params.runImmediately +}); } saveQuery (params) { let query = this._getSavedQueryDetails(params); if (!query) return; + +var options = { + parameters: query.parameters, + description: query.description, + name: query.name +}; + AdhocQueryActions - .saveQuery(query.secretToken, query.user, query.query, query.params); -this.setState({ clientMessage: clientMessages.saveQuery }); + .saveQuery(query.secretToken, query.user, query.query, options); + +this.setState({ + clientMessage: clientMessages.saveQuery, + runImmediately: params && params.runImmediately +}); } // internal which is called during save saved query & edit saved query @@ -329,14 +359,13 @@ class QueryBox extends React.Component { let user = UserStore.getUserDetails().email; let query =
[12/50] [abbrv] lens git commit: LENS-865: Add/delete partition throws NPE when a part col doesn't exist in the table
http://git-wip-us.apache.org/repos/asf/lens/blob/e5691d8d/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java -- diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java b/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java index 0748d5b..fb937c6 100644 --- a/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java +++ b/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java @@ -26,13 +26,17 @@ import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.xml.bind.JAXBElement; -import org.apache.lens.api.*; +import org.apache.lens.api.APIResult; import org.apache.lens.api.APIResult.*; +import org.apache.lens.api.DateTime; +import org.apache.lens.api.LensSessionHandle; +import org.apache.lens.api.StringList; import org.apache.lens.api.metastore.*; import org.apache.lens.server.LensServices; import org.apache.lens.server.api.error.LensException; import org.apache.lens.server.api.metastore.CubeMetastoreService; +import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.hive.ql.metadata.HiveException; @@ -52,11 +56,11 @@ import lombok.extern.slf4j.Slf4j; public class MetastoreResource { public static final ObjectFactory X_CUBE_OBJECT_FACTORY = new ObjectFactory(); - public CubeMetastoreService getSvc() { + public static CubeMetastoreService getSvc() { return LensServices.get().getService(CubeMetastoreService.NAME); } - private void checkSessionId(LensSessionHandle sessionHandle) { + private static void checkSessionId(LensSessionHandle sessionHandle) { if (sessionHandle == null) { throw new BadRequestException("Invalid session handle"); } @@ -75,6 +79,154 @@ public class MetastoreResource { checkNonNullArgs("One partition is null", partitions.getPartition().toArray()); } + private static LensException processLensException(LensException exc) { +if (exc != null) { + exc.buildLensErrorTO(LensServices.get().getErrorCollection()); +} +return exc; + } + + public enum Entity { +DATABASE { + @Override + public List doGetAll(LensSessionHandle sessionHandle) throws LensException { +return getSvc().getAllDatabases(sessionHandle); + } + + @Override + public void doDelete(LensSessionHandle sessionid, String entityName, Boolean cascade) throws LensException { +if (cascade == null) { + throw new NotImplementedException(); +} else { + getSvc().dropDatabase(sessionid, entityName, cascade); +} + } + +}, STORAGE { + @Override + public List doGetAll(LensSessionHandle sessionid) throws LensException { +return getSvc().getAllStorageNames(sessionid); + } + + @Override + public void doDelete(LensSessionHandle sessionid, String entityName, Boolean cascade) throws LensException { +if (cascade == null) { + getSvc().dropStorage(sessionid, entityName); +} else { + throw new NotImplementedException(); +} + } +}, CUBE { + @Override + public List doGetAll(LensSessionHandle sessionHandle) throws LensException { +return getSvc().getAllCubeNames(sessionHandle); + } + + @Override + public void doDelete(LensSessionHandle sessionid, String entityName, Boolean cascade) throws LensException { +if (cascade == null) { + getSvc().dropCube(sessionid, entityName); +} else { + throw new NotImplementedException(); +} + } +}, FACT { + @Override + public List doGetAll(LensSessionHandle sessionid) throws LensException { +return getSvc().getAllFactNames(sessionid, null); + } + + @Override + public void doDelete(LensSessionHandle sessionid, String entityName, Boolean cascade) throws LensException { +if (cascade == null) { + throw new NotImplementedException(); +} else { + getSvc().dropFactTable(sessionid, entityName, cascade); +} + } +}, DIMENSION { + @Override + public List doGetAll(LensSessionHandle sessionid) throws LensException { +return getSvc().getAllDimensionNames(sessionid); + } + + @Override + public void doDelete(LensSessionHandle sessionid, String entityName, Boolean cascade) throws LensException { +if (cascade == null) { + getSvc().dropDimension(sessionid, entityName); +} else { + throw new NotImplementedException(); +} + } +}, DIMTABLE { + @Override + public List doGetAll(LensSessionHandle sessionid) throws LensException { +return getSvc().getAllDimTableNames(sessionid, null); + } + + @Override + public void
[21/50] [abbrv] lens git commit: LENS-871 : Fix Dropping any partition in dimtable is clearing latest cache for that dimtable.
http://git-wip-us.apache.org/repos/asf/lens/blob/87049563/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java -- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java b/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java index d938ff7..e415a5a 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/metadata/TestCubeMetastoreClient.java @@ -19,12 +19,12 @@ package org.apache.lens.cube.metadata; -import static org.apache.lens.cube.metadata.UpdatePeriod.DAILY; -import static org.apache.lens.cube.metadata.UpdatePeriod.HOURLY; -import static org.apache.lens.cube.metadata.UpdatePeriod.MONTHLY; +import static org.apache.lens.cube.metadata.MetastoreUtil.*; +import static org.apache.lens.cube.metadata.UpdatePeriod.*; +import static org.apache.lens.cube.parse.CubeTestSetup.DateOffsetProvider; +import static org.apache.lens.server.api.util.LensUtil.getHashMap; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; +import static org.testng.Assert.*; import java.util.*; @@ -37,6 +37,7 @@ import org.apache.lens.cube.metadata.timeline.StoreAllPartitionTimeline; import org.apache.lens.cube.metadata.timeline.TestPartitionTimelines; import org.apache.lens.cube.parse.TimeRange; import org.apache.lens.server.api.error.LensException; +import org.apache.lens.server.api.util.LensUtil; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.AlreadyExistsException; @@ -50,13 +51,14 @@ import org.apache.hadoop.hive.serde.serdeConstants; import org.apache.hadoop.mapred.SequenceFileInputFormat; import org.apache.hadoop.mapred.TextInputFormat; -import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.google.common.collect.Sets; public class TestCubeMetastoreClient { @@ -71,35 +73,35 @@ public class TestCubeMetastoreClient { private static Set dimensions; private static Set cubeMeasures; private static Set cubeDimensions; + private static Set hourlyAndDaily = Sets.newHashSet(HOURLY, DAILY); private static final String CUBE_NAME = "testMetastoreCube"; private static final String CUBE_NAME_WITH_PROPS = "testMetastoreCubeWithProps"; private static final String DERIVED_CUBE_NAME = "derivedTestMetastoreCube"; private static final String DERIVED_CUBE_NAME_WITH_PROPS = "derivedTestMetastoreCubeWithProps"; - private static final MapCUBE_PROPERTIES = new HashMap (); - private static Date now; - private static Date nowPlus1; - private static Date nowPlus2; - private static Date nowPlus3; - private static Date nowMinus1; - private static Date nowMinus2; - private static Date nowMinus3; - private static Date nowMinus4; - private static Date nowMinus5; + private static final Map CUBE_PROPERTIES = new HashMap<>(); private static HiveConf conf = new HiveConf(TestCubeMetastoreClient.class); private static FieldSchema dtPart = new FieldSchema(getDatePartitionKey(), serdeConstants.STRING_TYPE_NAME, "date partition"); + private static ArrayList datePartKeySingleton = Lists.newArrayList(getDatePartitionKey()); + private static ArrayList datePartSingleton = Lists.newArrayList(getDatePartition()); + private static Map emptyHashMap = ImmutableMap.copyOf(LensUtil. getHashMap()); private static String c1 = "C1"; private static String c2 = "C2"; private static String c3 = "C3"; private static String c4 = "C4"; private static Dimension zipDim, cityDim, stateDim, countryDim; - private static Set zipAttrs = new HashSet(); - private static Set cityAttrs = new HashSet(); - private static Set stateAttrs = new HashSet(); - private static Set countryAttrs = new HashSet(); - private static Set cubeExpressions = new HashSet(); - private static Set joinChains = new HashSet(); - private static Set dimExpressions = new HashSet(); + private static Set zipAttrs = new HashSet<>(); + private static Set cityAttrs = new HashSet<>(); + private static Set stateAttrs = new HashSet<>(); + private static Set countryAttrs = new HashSet<>(); + private static Set cubeExpressions = new HashSet<>(); + private static Set joinChains = new HashSet<>(); + private static Set dimExpressions = new HashSet<>(); + private static DateOffsetProvider dateOffsetProvider = new DateOffsetProvider(HOURLY); + + public static Date getDateWithOffset(int i) { +return dateOffsetProvider.get(i); + } /** * Get the date partition as field schema
[17/50] [abbrv] lens git commit: LENS-851 : Disable union for multi fact queries
LENS-851 : Disable union for multi fact queries Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/7a3a1734 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/7a3a1734 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/7a3a1734 Branch: refs/heads/LENS-581 Commit: 7a3a1734e17898240f9be3812ab886d46718f0e3 Parents: 73716cb Author: Rajat KhandelwalAuthored: Wed Nov 25 10:20:16 2015 +0530 Committer: Amareshwari Sriramadasu Committed: Wed Nov 25 10:20:16 2015 +0530 -- .../java/org/apache/lens/cube/parse/MultiFactHQLContext.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/7a3a1734/lens-cube/src/main/java/org/apache/lens/cube/parse/MultiFactHQLContext.java -- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/MultiFactHQLContext.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/MultiFactHQLContext.java index 2fcea8b..113d8de 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/parse/MultiFactHQLContext.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/MultiFactHQLContext.java @@ -94,7 +94,7 @@ class MultiFactHQLContext extends SimpleHQLContext { for (int i = 0; i < query.getSelectAST().getChildCount(); i++) { if (selectToFactIndex.get(i) == null) { throw new LensException(LensCubeErrorCode.EXPRESSION_NOT_IN_ANY_FACT.getLensErrorInfo(), -HQLParser.getString((ASTNode) query.getSelectAST().getChild(i))); + HQLParser.getString((ASTNode) query.getSelectAST().getChild(i))); } if (selectToFactIndex.get(i).size() == 1) { select.append("mq").append(selectToFactIndex.get(i).get(0)).append(".") @@ -130,6 +130,10 @@ class MultiFactHQLContext extends SimpleHQLContext { Iterator iter = facts.iterator(); while (iter.hasNext()) { CandidateFact fact = iter.next(); + if (fact.getStorageTables().size() > 1) { +// Not supported right now. +throw new LensException(LensCubeErrorCode.STORAGE_UNION_DISABLED.getLensErrorInfo()); + } FactHQLContext facthql = new FactHQLContext(fact, dimsToQuery, factDimMap.get(fact), query); fromBuilder.append("("); fromBuilder.append(facthql.toHQL());