hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amareshw...@apache.org
Subject svn commit: r1482215 - in /hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse: CubeTestSetup.java TestMaxUpdateInterval.java
Date Tue, 14 May 2013 06:20:47 GMT
Author: amareshwari
Date: Tue May 14 06:20:46 2013
New Revision: 1482215

URL: http://svn.apache.org/r1482215
Log:
Add test for weekly update period

Modified:
    hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/CubeTestSetup.java
    hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/TestMaxUpdateInterval.java

Modified: hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/CubeTestSetup.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/CubeTestSetup.java?rev=1482215&r1=1482214&r2=1482215&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/CubeTestSetup.java
(original)
+++ hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/CubeTestSetup.java
Tue May 14 06:20:46 2013
@@ -125,6 +125,34 @@ public class CubeTestSetup {
         storageAggregatePeriods, 0L);
   }
 
+  private void createCubeFactWeekly(CubeMetastoreClient client) throws HiveException {
+    String factName = "testFactWeekly";
+    List<FieldSchema> factColumns = new ArrayList<FieldSchema>(
+        cubeMeasures.size());
+    for (CubeMeasure measure : cubeMeasures) {
+      factColumns.add(measure.getColumn());
+    }
+
+    // add dimensions of the cube
+    factColumns.add(new FieldSchema("zipcode","int", "zip"));
+
+    Map<Storage, List<UpdatePeriod>> storageAggregatePeriods =
+        new HashMap<Storage, List<UpdatePeriod>>();
+    List<UpdatePeriod> updates  = new ArrayList<UpdatePeriod>();
+    updates.add(UpdatePeriod.HOURLY);
+    updates.add(UpdatePeriod.DAILY);
+    updates.add(UpdatePeriod.WEEKLY);
+    updates.add(UpdatePeriod.MONTHLY);
+    Storage hdfsStorage = new HDFSStorage("C1",
+        TextInputFormat.class.getCanonicalName(),
+        HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
+    storageAggregatePeriods.put(hdfsStorage, updates);
+
+    // create cube fact
+    client.createCubeFactTable(cubeName, factName, factColumns,
+        storageAggregatePeriods, 0L);
+  }
+
   private void createCubeFactOnlyHourly(CubeMetastoreClient client)
       throws HiveException {
     String factName = "testFact2";
@@ -284,6 +312,7 @@ public class CubeTestSetup {
         new HiveConf(this.getClass()));
     createCube(client);
     createCubeFact(client);
+    createCubeFactWeekly(client);
     createCubeFactOnlyHourly(client);
     createCityTbale(client);
     createCubeFactMonthly(client);

Modified: hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/TestMaxUpdateInterval.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/TestMaxUpdateInterval.java?rev=1482215&r1=1482214&r2=1482215&view=diff
==============================================================================
--- hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/TestMaxUpdateInterval.java
(original)
+++ hive/branches/HIVE-4115/ql/src/test/org/apache/hadoop/hive/ql/cube/parse/TestMaxUpdateInterval.java
Tue May 14 06:20:46 2013
@@ -23,7 +23,8 @@ public class TestMaxUpdateInterval<perio
     "2013-Jan-01", "2013-Dec-31",
     "2013-Feb-01", "2013-Apr-25",
     "2012-Feb-01", "2013-Feb-01",
-    "2011-Feb-01", "2013-Feb-01"
+    "2011-Feb-01", "2013-Feb-01",
+    "2013-Feb-01", "2013-Feb-21"
   };
 
   public static final SimpleDateFormat DATE_FMT = new SimpleDateFormat("yyyy-MMM-dd");
@@ -73,6 +74,10 @@ public class TestMaxUpdateInterval<perio
 
     i+=2;
     Assert.assertEquals(UpdatePeriod.YEARLY, fact.maxIntervalInRange(pairs[i], pairs[i+1]));
+
+    CubeFactTable weeklyFact = client.getFactTable("testFactWeekly");
+    i+=2;
+    Assert.assertEquals(UpdatePeriod.WEEKLY, weeklyFact.maxIntervalInRange(pairs[i], pairs[i+1]));
   }
 
 }



Mime
View raw message