kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaofeng...@apache.org
Subject [2/2] kylin git commit: KYLIN-2764 Apply KYLIN-2800
Date Mon, 23 Oct 2017 03:59:08 GMT
KYLIN-2764 Apply KYLIN-2800


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

Branch: refs/heads/master
Commit: 48f3fb1953a413acfdd405539a7cfd211a5e85de
Parents: 3941b4d
Author: kangkaisen <kangkaisen@meituan.com>
Authored: Sun Oct 22 13:35:15 2017 +0800
Committer: kangkaisen <kangkaisen@meituan.com>
Committed: Sun Oct 22 13:47:25 2017 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/cube/CubeManager.java | 30 +--------------
 .../apache/kylin/dict/DictionaryManager.java    | 40 --------------------
 2 files changed, 1 insertion(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/48f3fb19/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java b/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java
index 180c3f4..b18d40f 100755
--- a/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java
@@ -833,26 +833,6 @@ public class CubeManager implements IRealizationProvider {
 
     // ============================================================================
 
-
-    /**
-     * Get the columns which need build the dictionary from fact table. (the column exists
on fact and is not fk)
-     * @param cubeDesc
-     * @return
-     * @throws IOException
-     */
-    public List<TblColRef> getAllDictColumnsOnFact(CubeDesc cubeDesc) throws IOException
{
-        List<TblColRef> factDictCols = new ArrayList<TblColRef>();
-        DictionaryManager dictMgr = DictionaryManager.getInstance(config);
-        for (TblColRef col : cubeDesc.getAllColumnsNeedDictionaryBuilt()) {
-
-            String scanTable = dictMgr.decideSourceData(cubeDesc.getModel(), col).getTable();
-            if (cubeDesc.getModel().isFactTable(scanTable)) {
-                factDictCols.add(col);
-            }
-        }
-        return factDictCols;
-    }
-
     public List<TblColRef> getAllGlobalDictColumns(CubeDesc cubeDesc) {
         List<TblColRef> globalDictCols = new ArrayList<TblColRef>();
         List<DictionaryDesc> dictionaryDescList = cubeDesc.getDictionaries();
@@ -874,19 +854,11 @@ public class CubeManager implements IRealizationProvider {
         List<TblColRef> uhcColumns = new ArrayList<TblColRef>();
         uhcColumns.addAll(getAllGlobalDictColumns(cubeDesc));
         uhcColumns.addAll(cubeDesc.getShardByColumns());
-
-        //handle PK-FK, see getAllDictColumnsOnFact
-        try {
-            uhcColumns.retainAll(getAllDictColumnsOnFact(cubeDesc));
-        } catch (IOException e) {
-            throw new RuntimeException("Get all dict columns on fact failed");
-        }
-
         return uhcColumns;
     }
 
     public int[] getUHCIndex(CubeDesc cubeDesc) throws IOException {
-        List<TblColRef> factDictCols = getAllDictColumnsOnFact(cubeDesc);
+        List<TblColRef> factDictCols = Lists.newArrayList(cubeDesc.getAllColumnsNeedDictionaryBuilt());
         List<TblColRef> uhcColumns = getAllUHCColumns(cubeDesc);
         int[] uhcIndex = new int[factDictCols.size()];
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/48f3fb19/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
index 7ce608b..e97899c 100755
--- a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
+++ b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java
@@ -29,17 +29,13 @@ import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.lang.ArrayUtils;
 import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.persistence.ResourceStore;
 import org.apache.kylin.common.util.ClassUtil;
 import org.apache.kylin.common.util.Dictionary;
 import org.apache.kylin.common.util.JsonUtil;
 import org.apache.kylin.metadata.datatype.DataType;
-import org.apache.kylin.metadata.model.DataModelDesc;
 import org.apache.kylin.metadata.model.DataModelManager;
-import org.apache.kylin.metadata.model.JoinDesc;
-import org.apache.kylin.metadata.model.TableRef;
 import org.apache.kylin.metadata.model.TblColRef;
 import org.apache.kylin.source.IReadableTable;
 import org.apache.kylin.source.IReadableTable.TableSignature;
@@ -346,42 +342,6 @@ public class DictionaryManager {
         return dictInfo;
     }
 
-    /**
-     * Decide a dictionary's source data, leverage PK-FK relationship.
-     */
-    public TblColRef decideSourceData(DataModelDesc model, TblColRef col) {
-        // Note FK on fact table is supported by scan the related PK on lookup table
-        // FK on fact table and join type is inner, use PK from lookup instead
-        if (model.isFactTable(col.getTable()) == false)
-            return col;
-
-        // find a lookup table that the col joins as FK
-        for (TableRef lookup : model.getLookupTables()) {
-            JoinDesc lookupJoin = model.getJoinByPKSide(lookup);
-            int find = ArrayUtils.indexOf(lookupJoin.getForeignKeyColumns(), col);
-            if (find < 0)
-                continue;
-
-            // make sure the joins are all inner up to the root
-            if (isAllInnerJoinsToRoot(model, lookupJoin))
-                return lookupJoin.getPrimaryKeyColumns()[find];
-        }
-
-        return col;
-    }
-
-    private boolean isAllInnerJoinsToRoot(DataModelDesc model, JoinDesc join) {
-        while (join != null) {
-            if (join.isInnerJoin() == false)
-                return false;
-
-            TableRef table = join.getFKSide();
-            join = model.getJoinByPKSide(table);
-        }
-        return true;
-    }
-
-
     private String checkDupByInfo(DictionaryInfo dictInfo) throws IOException {
         final ResourceStore store = DataModelManager.getInstance(config).getStore();
         final List<DictionaryInfo> allResources = store.getAllResources(dictInfo.getResourceDir(),
DictionaryInfo.class, DictionaryInfoSerializer.INFO_SERIALIZER);


Mime
View raw message