LENS-1437 : Missing unit test cases for virtual fact

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

Branch: refs/heads/master
Commit: fbad350798a342a4de5e5b8b566a6f055338fde3
Parents: d49f45a
Author: Rajitha R <rajitha....@gmail.com>
Authored: Tue Jun 27 16:12:56 2017 +0530
Committer: Rajat Khandelwal <rajatgupt...@gmail.com>
Committed: Thu Jul 13 14:42:54 2017 +0530

----------------------------------------------------------------------
 .../apache/lens/cube/parse/CubeTestSetup.java   |   4 +-
 .../lens/cube/parse/TestCubeRewriter.java       |  18 +--
 .../lens/cube/parse/TestVirtualFactQueries.java | 123 +++++++++++++++++++
 .../resources/schema/cubes/base/testcube2.xml   |  31 +++++
 .../resources/schema/cubes/base/virtualcube.xml |  23 +++-
 .../resources/schema/facts/testfact7_base.xml   |  67 ++++++++++
 .../resources/schema/facts/testfact8_base.xml   |  58 +++++++++
 .../resources/schema/facts/testfact9_base.xml   |  57 +++++++++
 .../schema/facts/virtual/virtualfact.xml        |   2 +-
 9 files changed, 361 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lens/blob/fbad3507/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 48869c2..0366e56 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
@@ -364,7 +364,7 @@ public class CubeTestSetup {
   // storageName[0] is hourly
   // storageName[1] is daily
   // storageName[2] is monthly
-  public static Map<String, String> 
getWhereForMonthlyDailyAndHourly2months(String... storageTables) {
+  public static Map<String, String> 
getWhereForMonthlyDailyAndHourly2months(String cubeName, String... 
storageTables) {
     Map<String, String> storageTableToWhereClause = new LinkedHashMap<String, 
String>();
     List<String> hourlyparts = new ArrayList<String>();
     List<String> dailyparts = new ArrayList<String>();
@@ -411,7 +411,7 @@ public class CubeTestSetup {
       tables.append(storageTables[0]);
     }
     Collections.sort(parts);
-    storageTableToWhereClause.put(tables.toString(), 
StorageUtil.getWherePartClause("dt", TEST_CUBE_NAME, parts));
+    storageTableToWhereClause.put(tables.toString(), 
StorageUtil.getWherePartClause("dt", cubeName, parts));
     return storageTableToWhereClause;
   }
 

http://git-wip-us.apache.org/repos/asf/lens/blob/fbad3507/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 d8c7335..1c75e6c 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
@@ -145,22 +145,6 @@ public class TestCubeRewriter extends TestQueryRewrite {
 //    assertNotNull(rewrittenQuery.getNonExistingParts());
   }
 
-
-  @Test
-  public void testVirtualFactCubeSimpleQuery() throws Exception {
-    Configuration conf = getConf();
-    conf.set(DRIVER_SUPPORTED_STORAGES, "C1");
-    CubeQueryContext rewrittenQuery =
-      rewriteCtx("select SUM(msr2) from virtualCube where " + TWO_DAYS_RANGE, 
getConfWithStorages("C1"));
-    String expected = getExpectedQuery(VIRTUAL_CUBE_NAME, "select 
sum(virtualcube.msr2) as `sum(msr2)` FROM ",
-      null, "AND ( dim1 = 10 )", 
getWhereForDailyAndHourly2days(VIRTUAL_CUBE_NAME,
-        "C1_summary1"));
-    String hql = rewrittenQuery.toHQL();
-    compareQueries(hql, expected);
-    System.out.println("Non existing parts:" + 
rewrittenQuery.getNonExistingParts());
-  }
-
-
   @Test
   public void testMaxCoveringFact() throws Exception {
     Configuration conf = getConf();
@@ -954,7 +938,7 @@ public class TestCubeRewriter extends TestQueryRewrite {
       rewrite("select SUM(msr2) from testCube" + " where " + 
TWO_MONTHS_RANGE_UPTO_HOURS, getConfWithStorages("C2"));
     String expected =
       getExpectedQuery(TEST_CUBE_NAME, "select sum(testcube.msr2) as 
`sum(msr2)` FROM ", null, null,
-        getWhereForMonthlyDailyAndHourly2months("C2_testfact"));
+        getWhereForMonthlyDailyAndHourly2months(TEST_CUBE_NAME, 
"C2_testfact"));
     compareQueries(hqlQuery, expected);
   }
 

http://git-wip-us.apache.org/repos/asf/lens/blob/fbad3507/lens-cube/src/test/java/org/apache/lens/cube/parse/TestVirtualFactQueries.java
----------------------------------------------------------------------
diff --git 
a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestVirtualFactQueries.java
 
b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestVirtualFactQueries.java
new file mode 100644
index 0000000..4bcb376
--- /dev/null
+++ 
b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestVirtualFactQueries.java
@@ -0,0 +1,123 @@
+/**
+ * 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 static org.apache.lens.cube.metadata.DateFactory.*;
+import static org.apache.lens.cube.parse.CubeQueryConfUtil.*;
+import static 
org.apache.lens.cube.parse.CubeQueryConfUtil.DISABLE_AGGREGATE_RESOLVER;
+import static org.apache.lens.cube.parse.CubeTestSetup.*;
+
+import static org.testng.Assert.assertEquals;
+
+import org.apache.lens.server.api.LensServerAPITestUtil;
+
+import org.apache.hadoop.conf.Configuration;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class TestVirtualFactQueries extends TestQueryRewrite {
+
+  private Configuration conf;
+
+  @BeforeTest
+  public void setupDriver() throws Exception {
+    conf = LensServerAPITestUtil.getConfiguration(
+      DRIVER_SUPPORTED_STORAGES, "C1",
+      DISABLE_AUTO_JOINS, false,
+      ENABLE_SELECT_TO_GROUPBY, true,
+      ENABLE_GROUP_BY_TO_SELECT, true,
+      DISABLE_AGGREGATE_RESOLVER, false);
+  }
+
+  @Override
+  public Configuration getConf() {
+    return new Configuration(conf);
+  }
+
+  @Test
+  public void testVirtualFactDayQuery() throws Exception {
+    CubeQueryContext rewrittenQuery =
+      rewriteCtx("select SUM(msr1) from virtualCube where " + TWO_DAYS_RANGE, 
getConfWithStorages("C1"));
+    String expected = getExpectedQuery(VIRTUAL_CUBE_NAME, "select 
sum(virtualcube.msr1) as `sum(msr1)` FROM ",
+      null, "AND ( dim1 = 10 )", 
getWhereForDailyAndHourly2days(VIRTUAL_CUBE_NAME,
+        "C1_testfact9_base"));
+    String hql = rewrittenQuery.toHQL();
+    compareQueries(hql, expected);
+  }
+
+  @Test
+  public void testVirtualFactMonthQuery() throws Exception {
+
+    CubeQueryContext rewrittenQuery =
+      rewriteCtx("select SUM(msr1) from virtualCube where " + 
TWO_MONTHS_RANGE_UPTO_HOURS, getConfWithStorages("C1"));
+    String expected = getExpectedQuery(VIRTUAL_CUBE_NAME, "select 
sum(virtualcube.msr1) as `sum(msr1)` FROM ",
+      null, "AND ( dim1 = 10 )", 
getWhereForMonthlyDailyAndHourly2months("virtualcube",
+        "C1_testfact9_base"));
+    String hql = rewrittenQuery.toHQL();
+    compareQueries(hql, expected);
+  }
+
+  static void compareQueries(String actual, String expected) {
+    assertEquals(new TestQuery(actual), new TestQuery(expected));
+  }
+
+  @Test
+  public void testVirtualFactUnionQuery() throws Exception {
+
+    String expectedInnerSelect = getExpectedQuery("virtualcube", "SELECT 
(virtualcube.cityid) AS `alias0`,"
+        + " sum((virtualcube.msr2)) AS `alias1`,0.0 AS `alias2` FROM ",
+      null, null, "GROUP BY (virtualcube.cityid)", null,
+      getWhereForDailyAndHourly2days("virtualcube", "c1_testfact8_base"))
+      + " UNION ALL " + getExpectedQuery("virtualcube", "SELECT 
(virtualcube.cityid) AS `alias0`,"
+        + "0.0 AS `alias1`, sum((virtualcube.msr3)) AS `alias2` FROM ",
+      null, null, "GROUP BY (virtualcube.cityid)", null,
+      getWhereForDailyAndHourly2days("virtualcube", "c1_testfact7_base"));
+
+
+    String expected = "SELECT (virtualcube.alias0) AS `cityid`,"
+      + " sum((virtualcube.alias1)) AS `sum(msr2)`, sum((virtualcube.alias2)) 
AS `sum(msr3)`"
+      + " FROM (" + expectedInnerSelect + ") AS virtualcube GROUP BY 
(virtualcube.alias0)";
+
+    CubeQueryContext rewrittenQuery =
+      rewriteCtx("select cityid as `cityid`, SUM(msr2), SUM(msr3) from 
virtualcube where " + TWO_DAYS_RANGE,
+        getConfWithStorages("C1"));
+    String hql = rewrittenQuery.toHQL();
+    compareQueries(hql, expected);
+  }
+
+  @Test
+  public void testVirtualFactJoinQuery() throws Exception {
+    String query, hqlQuery, expected;
+
+    // Single joinchain with direct link
+    query = "select cubestate.name, sum(msr2) from virtualcube where " + 
TWO_DAYS_RANGE + " group by cubestate.name";
+    hqlQuery = rewrite(query, conf);
+    expected = getExpectedQuery("virtualcube", "SELECT (cubestate.name) as 
`name`, sum((virtualcube.msr2)) "
+        + "as `sum(msr2)` FROM ",
+      " join " + getDbName() + "c1_statetable cubestate ON 
virtualcube.stateid=cubeState.id and cubeState.dt= 'latest'",
+      null, "group by cubestate.name",
+      null, getWhereForDailyAndHourly2days("virtualcube", 
"c1_testfact8_base"));
+    TestCubeRewriter.compareQueries(hqlQuery, expected);
+
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/lens/blob/fbad3507/lens-cube/src/test/resources/schema/cubes/base/testcube2.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/cubes/base/testcube2.xml 
b/lens-cube/src/test/resources/schema/cubes/base/testcube2.xml
new file mode 100644
index 0000000..9740e00
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/base/testcube2.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  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.
+
+-->
+<x_base_cube name="testcube2" xmlns="uri:lens:cube:0.1">
+  <properties>
+    <property name="cube.timedim.partition.d_time" value="dt"/>
+    <property name="cube.testcube.timed.dimensions.list" value="d_time"/>
+  </properties>
+  <measures>
+    <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr1" 
display_string="Measure1"
+             description="first measure"/>
+  </measures>
+</x_base_cube>

http://git-wip-us.apache.org/repos/asf/lens/blob/fbad3507/lens-cube/src/test/resources/schema/cubes/base/virtualcube.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/cubes/base/virtualcube.xml 
b/lens-cube/src/test/resources/schema/cubes/base/virtualcube.xml
index 2a5e0b0..187ac29 100644
--- a/lens-cube/src/test/resources/schema/cubes/base/virtualcube.xml
+++ b/lens-cube/src/test/resources/schema/cubes/base/virtualcube.xml
@@ -25,12 +25,31 @@
     <property name="cube.virtualcube.timed.dimensions.list" value="d_time"/>
   </properties>
   <measures>
+    <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr1" 
display_string="Measure1"
+             description="first measure"/>
     <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr2" 
display_string="Measure2"
              description="second measure"/>
+    <measure _type="DOUBLE" default_aggr="SUM" unit="RS" name="msr3" 
display_string="Measure3"
+             description="third measure"/>
 
   </measures>
   <dim_attributes>
-    <dim_attribute _type="string" name="dim1" description="basedim">
-    </dim_attribute>
+    <dim_attribute _type="string" name="dim1" description="basedim"/>
+    <dim_attribute _type="int" name="cityid" description="basedim"/>
+    <dim_attribute name="stateid" _type="int" description="state id"/>
   </dim_attributes>
+  <join_chains>
+    <join_chain dest_table="statedim" name="cubestate" 
display_string="cube-state" description="state thru cube">
+      <paths>
+        <path>
+          <edges>
+            <edge>
+              <from table="virtualcube" column="stateid" maps_to_many="false"/>
+              <to table="statedim" column="id" maps_to_many="false"/>
+            </edge>
+          </edges>
+        </path>
+      </paths>
+    </join_chain>
+  </join_chains>
 </x_base_cube>

http://git-wip-us.apache.org/repos/asf/lens/blob/fbad3507/lens-cube/src/test/resources/schema/facts/testfact7_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact7_base.xml 
b/lens-cube/src/test/resources/schema/facts/testfact7_base.xml
new file mode 100644
index 0000000..c63b951
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact7_base.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  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.
+
+-->
+<x_fact_table name="testfact7_base" cube_name="virtualcube" weight="5.0" 
xmlns="uri:lens:cube:0.1">
+  <columns>
+    <column name="msr3" _type="double" comment="msr3"/>
+    <column name="cityid" _type="int" comment="city id"/>
+    <column name="stateid" _type="int" comment="state id"/>
+  </columns>
+  <properties>
+    <property name="cube.fact.testfact.c5.updateperiods"
+              
value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+    <property name="cube.fact.testfact.cubename" value="testCube"/>
+    <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+    <property name="cube.fact.testfact.c4.updateperiods"
+              
value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+    <property name="cube.table.testfact.weight" value="5.0"/>
+    <property name="cube.fact.testfact.c3.updateperiods"
+              
value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+    <property name="cube.fact.testfact.c2.updateperiods"
+              
value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+    <property name="cube.fact.testfact.storages" value="C3,C4,C5,C0,C1,C2"/>
+    <property name="cube.fact.testfact.c0.updateperiods"
+              
value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+    <property name="cube.fact.testfact.c1.updateperiods"
+              
value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+  </properties>
+  <storage_tables>
+    <storage_table>
+      <update_periods>
+        <update_period>HOURLY</update_period>
+        <update_period>DAILY</update_period>
+      </update_periods>
+      <storage_name>C1</storage_name>
+      <table_desc external="false">
+        <part_cols>
+          <column name="dt" _type="string" comment="date partition"/>
+        </part_cols>
+        <table_parameters>
+          <property name="cube.storagetable.time.partcols" value="dt"/>
+        </table_parameters>
+        <serde_parameters>
+          <property name="serialization.format" value="1"/>
+        </serde_parameters>
+        <time_part_cols>dt</time_part_cols>
+      </table_desc>
+    </storage_table>
+  </storage_tables>
+</x_fact_table>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/fbad3507/lens-cube/src/test/resources/schema/facts/testfact8_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact8_base.xml 
b/lens-cube/src/test/resources/schema/facts/testfact8_base.xml
new file mode 100644
index 0000000..5450b59
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact8_base.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  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.
+
+-->
+<x_fact_table name="testfact8_base" cube_name="virtualcube" weight="5.0" 
xmlns="uri:lens:cube:0.1">
+  <columns>
+
+    <column name="msr2" _type="float" comment="second measure"/>
+    <column name="cityid" _type="int" comment="city id"/>
+    <column name="stateid" _type="int" comment="state id"/>
+  </columns>
+  <properties>
+    <property name="cube.fact.testfact.cubename" value="testCube"/>
+    <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+    <property name="cube.table.testfact.weight" value="5.0"/>
+    <property name="cube.fact.testfact.storages" value="C1"/>
+    <property name="cube.fact.testfact.c1.updateperiods"
+              
value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+  </properties>
+  <storage_tables>
+    <storage_table>
+      <update_periods>
+        <update_period>HOURLY</update_period>
+        <update_period>DAILY</update_period>
+      </update_periods>
+      <storage_name>C1</storage_name>
+      <table_desc external="false">
+        <part_cols>
+          <column name="dt" _type="string" comment="date partition"/>
+        </part_cols>
+        <table_parameters>
+          <property name="cube.storagetable.time.partcols" value="dt"/>
+        </table_parameters>
+        <serde_parameters>
+          <property name="serialization.format" value="1"/>
+        </serde_parameters>
+        <time_part_cols>dt</time_part_cols>
+      </table_desc>
+    </storage_table>
+  </storage_tables>
+</x_fact_table>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/fbad3507/lens-cube/src/test/resources/schema/facts/testfact9_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact9_base.xml 
b/lens-cube/src/test/resources/schema/facts/testfact9_base.xml
new file mode 100644
index 0000000..56e5746
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact9_base.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  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.
+
+-->
+<x_fact_table name="testfact9_base" cube_name="testcube2" weight="5.0" 
xmlns="uri:lens:cube:0.1">
+  <columns>
+
+    <column name="msr1" _type="float" comment="second measure"/>
+  </columns>
+  <properties>
+    <property name="cube.fact.testfact.cubename" value="testCube"/>
+    <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+    <property name="cube.table.testfact.weight" value="5.0"/>
+    <property name="cube.fact.testfact.storages" value="C1"/>
+    <property name="cube.fact.testfact.c1.updateperiods"
+              
value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+  </properties>
+  <storage_tables>
+    <storage_table>
+      <update_periods>
+        <update_period>HOURLY</update_period>
+        <update_period>DAILY</update_period>
+        <update_period>MONTHLY</update_period>
+      </update_periods>
+      <storage_name>C1</storage_name>
+      <table_desc external="false">
+        <part_cols>
+          <column name="dt" _type="string" comment="date partition"/>
+        </part_cols>
+        <table_parameters>
+          <property name="cube.storagetable.time.partcols" value="dt"/>
+        </table_parameters>
+        <serde_parameters>
+          <property name="serialization.format" value="1"/>
+        </serde_parameters>
+        <time_part_cols>dt</time_part_cols>
+      </table_desc>
+    </storage_table>
+  </storage_tables>
+</x_fact_table>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/fbad3507/lens-cube/src/test/resources/schema/facts/virtual/virtualfact.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/virtual/virtualfact.xml 
b/lens-cube/src/test/resources/schema/facts/virtual/virtualfact.xml
index 860965f..13f6773 100644
--- a/lens-cube/src/test/resources/schema/facts/virtual/virtualfact.xml
+++ b/lens-cube/src/test/resources/schema/facts/virtual/virtualfact.xml
@@ -19,7 +19,7 @@
   under the License.
 
 -->
-<x_virtual_fact_table source_fact_name="summary1" cube_name="virtualcube" 
name="virtualfact1" xmlns="uri:lens:cube:0.1"
+<x_virtual_fact_table source_fact_name="testfact9_base" 
cube_name="virtualcube" name="virtualfact1" xmlns="uri:lens:cube:0.1"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
   <properties>
     <property name="cube.fact.query.where.filter" value=" dim1 = 10 "/>

Reply via email to