You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2015/09/23 05:29:52 UTC

incubator-kylin git commit: KYLIN-943 update test cases

Repository: incubator-kylin
Updated Branches:
  refs/heads/KYLIN-943 167386858 -> 594d4d7a3


KYLIN-943 update test cases

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

Branch: refs/heads/KYLIN-943
Commit: 594d4d7a3c8d19822dba0ab76ec8a99fc54c61b3
Parents: 1673868
Author: shaofengshi <sh...@apache.org>
Authored: Wed Sep 23 11:29:36 2015 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Wed Sep 23 11:29:36 2015 +0800

----------------------------------------------------------------------
 .../kylin/cube/inmemcubing/InMemCubeBuilder.java  |  3 ++-
 .../cube/inmemcubing/InMemCubeBuilderTest.java    | 18 ++++++++++++++++++
 .../test_kylin_cube_without_slr_desc.json         |  2 +-
 ...est_kylin_cube_without_slr_left_join_desc.json |  2 +-
 4 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/594d4d7a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java
index 3b426b9..3f1de40 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java
@@ -124,6 +124,7 @@ public class InMemCubeBuilder extends AbstractInMemCubeBuilder {
                 int displayColIdx = flatTableIdx[flatTableIdx.length - 1];
                 TblColRef displayCol = func.getParameter().getColRefs().get(flatTableIdx.length - 1);
                 Dictionary<String> dictionary = (Dictionary<String>)dictionaryMap.get(displayCol);
+                assert dictionary != null;
                 topNDisplayColDictMap.put(displayColIdx, dictionary);
             }
         }
@@ -480,7 +481,7 @@ public class InMemCubeBuilder extends AbstractInMemCubeBuilder {
             }
 
             // disable sanity check for performance
-            sanityCheck(scanner.getTotalSumForSanityCheck());
+//            sanityCheck(scanner.getTotalSumForSanityCheck());
         } finally {
             scanner.close();
             builder.close();

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/594d4d7a/core-cube/src/test/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilderTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilderTest.java b/core-cube/src/test/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilderTest.java
index 9f2e7d2..0604d32 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilderTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilderTest.java
@@ -42,6 +42,8 @@ import org.apache.kylin.cube.model.CubeJoinedFlatTableDesc;
 import org.apache.kylin.dict.Dictionary;
 import org.apache.kylin.dict.DictionaryGenerator;
 import org.apache.kylin.gridtable.GTRecord;
+import org.apache.kylin.metadata.model.FunctionDesc;
+import org.apache.kylin.metadata.model.MeasureDesc;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -179,6 +181,22 @@ public class InMemCubeBuilderTest extends LocalFileMetadataTestCase {
                 result.put(col, dict);
             }
         }
+
+        for (int measureIdx = 0; measureIdx < cube.getDescriptor().getMeasures().size(); measureIdx++) {
+            MeasureDesc measureDesc = cube.getDescriptor().getMeasures().get(measureIdx);
+            FunctionDesc func = measureDesc.getFunction();
+            if (func.isTopN()) {
+                int[] flatTableIdx = flatTableDesc.getMeasureColumnIndexes()[measureIdx];
+                int displayColIdx = flatTableIdx[flatTableIdx.length - 1];
+                TblColRef displayCol = func.getParameter().getColRefs().get(flatTableIdx.length - 1);
+                logger.info("Building dictionary for " + displayCol);
+                List<byte[]> valueList = readValueList(flatTable, nColumns, displayColIdx);
+                Dictionary<?> dict = DictionaryGenerator.buildDictionaryFromValueList(displayCol.getType(), valueList);
+
+                result.put(displayCol, dict);
+            }
+        }
+
         return result;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/594d4d7a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json
----------------------------------------------------------------------
diff --git a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json
index 0069d42..5a7bc83 100644
--- a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json
+++ b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_desc.json
@@ -173,7 +173,7 @@
           "value": "PRICE",
           "displaycolumn": "seller_id"
         },
-        "returntype": "topn(100)"
+        "returntype": "topn(20)"
       },
       "dependent_measure_ref": null
     }

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/594d4d7a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json
----------------------------------------------------------------------
diff --git a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json
index 4cc9f5f..266ede5 100644
--- a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json
+++ b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json
@@ -173,7 +173,7 @@
           "value": "PRICE",
           "displaycolumn": "seller_id"
         },
-        "returntype": "topn(100)"
+        "returntype": "topn(20)"
       },
       "dependent_measure_ref": null
     }