Reverse merge current-release-line
Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/9e7012ed Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/9e7012ed Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/9e7012ed Branch: refs/heads/master Commit: 9e7012ed9c4eb163ce7285042a10dcad935f9522 Parents: d0b78e8 865d202 Author: rajub <raju.bairishe...@lazada.com> Authored: Tue Feb 6 13:43:51 2018 +0800 Committer: rajub <raju.bairishe...@lazada.com> Committed: Tue Feb 6 13:43:51 2018 +0800 ---------------------------------------------------------------------- README.md | 4 ++-- contrib/clients/python/pom.xml | 3 +-- .../apache/lens/cube/parse/TestCubeRewriter.java | 13 +++++++++++++ .../lens/server/query/TestQueryService.java | 2 +- .../lens/server/scheduler/SchedulerDAOTest.java | 2 +- lens-ui/app/actions/SessionAction.js | 18 ++++++++++++++++++ lens-ui/app/adapters/SessionAdapter.js | 18 ++++++++++++++++++ lens-ui/app/components/SessionListComponent.js | 18 ++++++++++++++++++ lens-ui/app/constants/SessionConstants.js | 18 ++++++++++++++++++ lens-ui/app/stores/SessionStore.js | 18 ++++++++++++++++++ pom.xml | 12 ++++++++++-- src/site/apt/releases/download.apt | 2 +- src/site/apt/releases/release-history.apt | 10 ++++++++++ tools/scripts/generate-site-public.sh | 2 +- 14 files changed, 130 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lens/blob/9e7012ed/contrib/clients/python/pom.xml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lens/blob/9e7012ed/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java ---------------------------------------------------------------------- diff --cc lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java index e83eacb,9b54957..4fdb822 --- 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 @@@ -1467,58 -1467,15 +1467,71 @@@ public class TestCubeRewriter extends T .getParticipatingPartitions()); // pt does not exist beyond 1 day. So in this test, max look ahead possible is 3 assertEquals(partsQueried, expectedPartsQueried); + + //New test case for testing look ahead time parts + expectedPartsQueried = Sets.newTreeSet(); + conf.setInt(CubeQueryConfUtil.LOOK_AHEAD_TIME_PARTS_PFX + "daily", 2); + + ceilDay = DAILY.getCeilDate(getDateWithOffset(DAILY, -3)); + nextDay = DateUtils.addDays(ceilDay, 1); + nextToNextDay = DateUtils.addDays(nextDay, 1); + + for (TimePartition p : Iterables.concat( + TimePartition.of(HOURLY, getDateWithOffset(DAILY, -3)).rangeUpto(TimePartition.of(HOURLY, ceilDay)), + TimePartition.of(DAILY, ceilDay).rangeUpto(TimePartition.of(DAILY, nextDay)), + TimePartition.of(DAILY, nextDay).rangeUpto(TimePartition.of(DAILY, nextToNextDay)), + TimePartition.of(HOURLY, nextToNextDay).rangeUpto(TimePartition.of(HOURLY, NOW)))) { + FactPartition fp = new FactPartition("it", p, null, storageTables); + expectedPartsQueried.add(fp); + } + for (TimePartition it : TimePartition.of(HOURLY, ceilDay).rangeUpto(TimePartition.of(HOURLY, nextDay))) { + for (TimePartition pt : TimePartition.of(HOURLY, nextDay).rangeUpto(TimePartition.of(HOURLY, nextToNextDay))) { + FactPartition ptPartition = new FactPartition("pt", pt, null, storageTables); + FactPartition itPartition = new FactPartition("it", it, ptPartition, storageTables); + expectedPartsQueried.add(itPartition); + } + } + + ceilDay = DateUtils.addDays(ceilDay, 1); + nextDay = DateUtils.addDays(nextDay, 1); + nextToNextDay = DateUtils.addDays(nextToNextDay, 1); + + for (TimePartition it : TimePartition.of(HOURLY, ceilDay).rangeUpto(TimePartition.of(HOURLY, nextDay))) { + for (TimePartition pt : TimePartition.of(HOURLY, nextDay).rangeUpto(TimePartition.of(HOURLY, nextToNextDay))) { + FactPartition ptPartition = new FactPartition("pt", pt, null, storageTables); + FactPartition itPartition = new FactPartition("it", it, ptPartition, storageTables); + expectedPartsQueried.add(itPartition); + } + } + + ctx = rewriteCtx("select dim1, max(msr3)," + " msr2 from testCube" + " where " + THREE_DAYS_RANGE_IT, + conf); + partsQueried = new TreeSet<>(((StorageCandidate)ctx.getCandidates().iterator().next()) + .getParticipatingPartitions()); + // pt does not exist beyond 1 day. So in this test, max look ahead possible is 3 + assertEquals(partsQueried, expectedPartsQueried); + } + + @Test + public void testTimeRangeIn() throws Exception { + //check whether time_range_in is resolving in cube rewrite + Configuration conf = getConf(); + conf.set(CubeQueryConfUtil.PROCESS_TIME_PART_COL, "pt"); + conf.set(CubeQueryConfUtil.FAIL_QUERY_ON_PARTIAL_DATA, "true"); + conf.setClass(CubeQueryConfUtil.TIME_RANGE_WRITER_CLASS, AbridgedTimeRangeWriter.class, TimeRangeWriter.class); ++ CubeQueryContext ctx = rewriteCtx("select dim1, sum(msr23)" + " from testCube" + " where " + ONE_DAY_RANGE_IT, ++ conf); ++ String rewrittenQuery = ctx.toHQL(); ++ assertTrue(!rewrittenQuery.contains("time_range_in")); + } + + @Test + public void testTimeRangeIn() throws Exception { + //check whether time_range_in is resolving in cube rewrite + Configuration conf = getConf(); + conf.set(CubeQueryConfUtil.PROCESS_TIME_PART_COL, "pt"); + conf.set(CubeQueryConfUtil.FAIL_QUERY_ON_PARTIAL_DATA, "true"); + conf.setClass(CubeQueryConfUtil.TIME_RANGE_WRITER_CLASS, AbridgedTimeRangeWriter.class, TimeRangeWriter.class); CubeQueryContext ctx = rewriteCtx("select dim1, sum(msr23)" + " from testCube" + " where " + ONE_DAY_RANGE_IT, conf); String rewrittenQuery = ctx.toHQL(); http://git-wip-us.apache.org/repos/asf/lens/blob/9e7012ed/pom.xml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lens/blob/9e7012ed/tools/scripts/generate-site-public.sh ----------------------------------------------------------------------