You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2016/06/18 01:25:43 UTC

[2/3] kylin git commit: KYLIN-1766 fix LookupTableTest

KYLIN-1766 fix LookupTableTest


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

Branch: refs/heads/master
Commit: 5ee5a3daeef4f54a037ff65009bd66d65587327e
Parents: 35f3e63
Author: Li Yang <li...@apache.org>
Authored: Thu Jun 16 17:38:39 2016 +0800
Committer: Yang Li <li...@apache.org>
Committed: Sat Jun 18 09:06:44 2016 +0800

----------------------------------------------------------------------
 .../apache/kylin/dict/lookup/LookupTableTest.java | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/5ee5a3da/core-dictionary/src/test/java/org/apache/kylin/dict/lookup/LookupTableTest.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/test/java/org/apache/kylin/dict/lookup/LookupTableTest.java b/core-dictionary/src/test/java/org/apache/kylin/dict/lookup/LookupTableTest.java
index d3b817c..980a263 100644
--- a/core-dictionary/src/test/java/org/apache/kylin/dict/lookup/LookupTableTest.java
+++ b/core-dictionary/src/test/java/org/apache/kylin/dict/lookup/LookupTableTest.java
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.DateFormat;
 import org.apache.kylin.common.util.LocalFileMetadataTestCase;
 import org.apache.kylin.common.util.Pair;
 import org.apache.kylin.metadata.MetadataManager;
@@ -56,8 +57,8 @@ public class LookupTableTest extends LocalFileMetadataTestCase {
     @Test
     public void testScan() throws Exception {
         List<String> values = new ArrayList<String>();
-        values.add("2012-01-24");
-        values.add("2012-12-30");
+        values.add(millis("2012-01-24"));
+        values.add(millis("2012-12-30"));
         List<String> results = lookupTable.scan("CAL_DT", values, "YEAR_BEG_DT");
 
         Assert.assertTrue(results.size() > 0);
@@ -70,10 +71,7 @@ public class LookupTableTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testMapRange() throws Exception {
-        List<String> values = new ArrayList<String>();
-        values.add("2012-01-24");
-        values.add("2012-12-30");
-        Pair<String, String> results = lookupTable.mapRange("CAL_DT", "2012-01-24", "2012-12-30", "QTR_BEG_DT");
+        Pair<String, String> results = lookupTable.mapRange("CAL_DT", millis("2012-01-24"), millis("2012-12-30"), "QTR_BEG_DT");
 
         Assert.assertTrue(results != null);
         System.out.println("The first qtr_beg_dt is " + results.getFirst());
@@ -86,8 +84,8 @@ public class LookupTableTest extends LocalFileMetadataTestCase {
     @Test
     public void testMapValues() throws Exception {
         Set<String> values = new HashSet<String>();
-        values.add("2012-01-24");
-        values.add("2012-12-30");
+        values.add(millis("2012-01-24"));
+        values.add(millis("2012-12-30"));
         Set<String> results = lookupTable.mapValues("CAL_DT", values, "YEAR_BEG_DT");
 
         Assert.assertTrue(results.size() == 1);
@@ -97,6 +95,10 @@ public class LookupTableTest extends LocalFileMetadataTestCase {
             Assert.assertEquals("2012-01-01", i);
         }
     }
+    
+    private String millis(String dateStr) {
+        return String.valueOf(DateFormat.stringToMillis(dateStr));
+    }
 
     public LookupTable<String> initLookupTable() throws Exception {