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/10/22 23:29:40 UTC

[4/4] kylin git commit: KYLIN-1971 fix CI

KYLIN-1971 fix CI


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

Branch: refs/heads/KYLIN-1971
Commit: 1c278f36899b589ba145268262d64bf65a471194
Parents: cde08cd
Author: Yang Li <li...@apache.org>
Authored: Sun Oct 23 07:29:08 2016 +0800
Committer: Yang Li <li...@apache.org>
Committed: Sun Oct 23 07:29:08 2016 +0800

----------------------------------------------------------------------
 .../kylin/cube/CubeCapabilityChecker.java       |    5 +-
 .../kylin/metadata/model/DataModelDesc.java     |   13 +
 .../sample_cube/data/DEFAULT.KYLIN_SALES.csv    | 5290 +++++++++---------
 .../localmeta/data/data_gen_config.json         |   24 +
 .../source/hive/ITHiveTableReaderTest.java      |    2 +-
 5 files changed, 2684 insertions(+), 2650 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/1c278f36/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java
index 24f15e0..c8460f0 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeCapabilityChecker.java
@@ -66,10 +66,7 @@ public class CubeCapabilityChecker {
         Collection<FunctionDesc> unmatchedAggregations = unmatchedAggregations(aggrFunctions, cube);
 
         // try custom measure types
-        // in RAW query, unmatchedDimensions and unmatchedAggregations will null, so can't chose RAW cube well!
-        //        if (!unmatchedDimensions.isEmpty() || !unmatchedAggregations.isEmpty()) {
         tryCustomMeasureTypes(unmatchedDimensions, unmatchedAggregations, digest, cube, result);
-        //        }
 
         // try dimension-as-measure
         if (!unmatchedAggregations.isEmpty()) {
@@ -78,7 +75,7 @@ public class CubeCapabilityChecker {
             } else {
                 //deal with query on lookup table, like https://issues.apache.org/jira/browse/KYLIN-2030
                 if (cube.getSegments().get(0).getSnapshots().containsKey(digest.factTable)) {
-                    Set<TblColRef> dimCols = Sets.newHashSet(cube.getDataModelDesc().getFactTableRef().getColumns());
+                    Set<TblColRef> dimCols = Sets.newHashSet(cube.getDataModelDesc().findFirstTable(digest.factTable).getColumns());
                     tryDimensionAsMeasures(unmatchedAggregations, digest, cube, result, dimCols);
                 } else {
                     logger.info("Skip tryDimensionAsMeasures because current cube {} does not touch lookup table {} at all", cube.getName(), digest.factTable);

http://git-wip-us.apache.org/repos/asf/kylin/blob/1c278f36/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
index 0d37bb8..f23e1be 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
@@ -247,6 +247,7 @@ public class DataModelDesc extends RootPersistentEntity {
         return result;
     }
 
+    // find by unique name, that must uniquely identifies a table in the model
     public TableRef findTable(String table) {
         TableRef result = tableNameMap.get(table);
         if (result == null) {
@@ -254,6 +255,18 @@ public class DataModelDesc extends RootPersistentEntity {
         }
         return result;
     }
+    
+    // find by table identity, that may match multiple tables in the model
+    public TableRef findFirstTable(String tableIdentity) {
+        if (factTableRef.getTableIdentity().equals(tableIdentity))
+            return factTableRef;
+        
+        for (TableRef lookup : lookupTableRefs) {
+            if (lookup.getTableIdentity().equals(tableIdentity))
+                return lookup;
+        }
+        throw new IllegalArgumentException("Table not found by " + tableIdentity);
+    }
 
     public void init(KylinConfig config, Map<String, TableDesc> tables) {
         this.config = config;