Repository: kylin Updated Branches: refs/heads/KYLIN-1077 66ad13860 -> f1a332ab1
KYLIN-1077 small change and cover it in integration test Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/f1a332ab Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/f1a332ab Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/f1a332ab Branch: refs/heads/KYLIN-1077 Commit: f1a332ab175809c5d98c7d1c64f25559432e2203 Parents: 66ad138 Author: shaofengshi <shaofeng...@apache.org> Authored: Wed Apr 27 10:20:16 2016 +0800 Committer: shaofengshi <shaofeng...@apache.org> Committed: Wed Apr 27 10:20:16 2016 +0800 ---------------------------------------------------------------------- .../java/org/apache/kylin/job/DeployUtil.java | 13 + .../java/org/apache/kylin/cube/CubeManager.java | 2 +- .../apache/kylin/dict/DictionaryManager.java | 2 +- .../apache/kylin/metadata/model/TableDesc.java | 23 +- ...test_kylin_cube_with_slr_left_join_desc.json | 2 +- ...t_kylin_cube_without_slr_left_join_desc.json | 2 +- .../test_kylin_ii_left_join_desc.json | 2 +- .../test_kylin_left_join_model_desc.json | 4 +- .../localmeta/table/EDW.V_TEST_CAL_DT.json | 409 +++++++++++++++++++ .../apache/kylin/source/hive/HiveMRInput.java | 2 +- .../source/hive/HiveSourceTableLoader.java | 6 +- 11 files changed, 444 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java ---------------------------------------------------------------------- diff --git a/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java b/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java index 513f546..c790e44 100644 --- a/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java +++ b/assembly/src/test/java/org/apache/kylin/job/DeployUtil.java @@ -122,6 +122,7 @@ public class DeployUtil { // ============================================================================ static final String TABLE_CAL_DT = "edw.test_cal_dt"; + static final String VIEW_CAL_DT = "edw.v_test_cal_dt"; static final String TABLE_CATEGORY_GROUPINGS = "default.test_category_groupings"; static final String TABLE_KYLIN_FACT = "default.test_kylin_fact"; static final String TABLE_SELLER_TYPE_DIM = "edw.test_seller_type_dim"; @@ -214,6 +215,7 @@ public class DeployUtil { // create hive tables hiveClient.executeHQL("CREATE DATABASE IF NOT EXISTS EDW"); hiveClient.executeHQL(generateCreateTableHql(metaMgr.getTableDesc(TABLE_CAL_DT.toUpperCase()))); + hiveClient.executeHQL(generateCreateViewHql(VIEW_CAL_DT, metaMgr.getTableDesc(TABLE_CAL_DT.toUpperCase()))); hiveClient.executeHQL(generateCreateTableHql(metaMgr.getTableDesc(TABLE_CATEGORY_GROUPINGS.toUpperCase()))); hiveClient.executeHQL(generateCreateTableHql(metaMgr.getTableDesc(TABLE_KYLIN_FACT.toUpperCase()))); hiveClient.executeHQL(generateCreateTableHql(metaMgr.getTableDesc(TABLE_SELLER_TYPE_DIM.toUpperCase()))); @@ -255,6 +257,17 @@ public class DeployUtil { return new String[] { dropsql, ddl.toString() }; } + private static String[] generateCreateViewHql(String viewName, TableDesc tableDesc) { + + String dropsql = "DROP VIEW IF EXISTS " + viewName; + StringBuilder ddl = new StringBuilder(); + + ddl.append("CREATE VIEW " + viewName + " AS SELECT * FROM " + tableDesc.getIdentity() + "\n"); + ddl.append("(" + "\n"); + + return new String[] { dropsql, ddl.toString() }; + } + private static String getHiveDataType(String javaDataType) { String hiveDataType = javaDataType.toLowerCase().startsWith("varchar") ? "string" : javaDataType; hiveDataType = javaDataType.toLowerCase().startsWith("integer") ? "int" : hiveDataType; http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/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 93b113a..ef57ec5 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/CubeManager.java @@ -203,7 +203,7 @@ public class CubeManager implements IRealizationProvider { SnapshotManager snapshotMgr = getSnapshotManager(); TableDesc tableDesc = new TableDesc(metaMgr.getTableDesc(lookupTable)); - if (tableDesc.isSourceTableHiveView()) { + if (TableDesc.TABLE_TYPE_VIRTUAL_VIEW.equalsIgnoreCase(tableDesc.getTableType())) { tableDesc.setDatabase(config.getHiveDatabaseForIntermediateTable()); String tableName = tableDesc.getHiveViewIntermediateTableName(); tableDesc.setName(tableName); http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/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 12e347a..bd9eac6 100644 --- a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java +++ b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java @@ -276,7 +276,7 @@ public class DictionaryManager { } else { MetadataManager metadataManager = MetadataManager.getInstance(config); TableDesc tableDesc = new TableDesc(metadataManager.getTableDesc(srcTable)); - if (tableDesc.isSourceTableHiveView()) { + if (TableDesc.TABLE_TYPE_VIRTUAL_VIEW.equalsIgnoreCase(tableDesc.getTableType())) { tableDesc.setDatabase(config.getHiveDatabaseForIntermediateTable()); String tableName = tableDesc.getHiveViewIntermediateTableName(); tableDesc.setName(tableName); http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java ---------------------------------------------------------------------- diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java index 33f5d93..ab9f850 100644 --- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java +++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TableDesc.java @@ -35,15 +35,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; @SuppressWarnings("serial") @JsonAutoDetect(fieldVisibility = Visibility.NONE, getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE) public class TableDesc extends RootPersistentEntity implements ISourceAware { - + + public static final String TABLE_TYPE_VIRTUAL_VIEW = "VIRTUAL_VIEW"; @JsonProperty("name") private String name; @JsonProperty("columns") private ColumnDesc[] columns; @JsonProperty("source_type") private int sourceType = ISourceAware.ID_HIVE; - @JsonProperty("source_table_type") - private boolean sourceTableHiveViewFlag = false; + @JsonProperty("table_type") + private String tableType; @JsonProperty("hive_view__table_name_prefix") private String hiveViewIntermediateTableNamePrefix = "kylin_intermediate_"; @@ -177,14 +178,6 @@ public class TableDesc extends RootPersistentEntity implements ISourceAware { } } - public void setSourceTableHiveViewFlag(boolean sourceTableHiveViewFlag) { - this.sourceTableHiveViewFlag = sourceTableHiveViewFlag; - } - - public boolean isSourceTableHiveView(){ - return sourceTableHiveViewFlag; - } - public String getHiveViewIntermediateTableName() { return hiveViewIntermediateTableNamePrefix + "_" + database.getName() + "_" + name; } @@ -210,6 +203,14 @@ public class TableDesc extends RootPersistentEntity implements ISourceAware { this.sourceType = sourceType; } + public String getTableType() { + return tableType; + } + + public void setTableType(String tableType) { + this.tableType = tableType; + } + public String getHiveViewIntermediateTableNamePrefix() { return hiveViewIntermediateTableNamePrefix; } http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_with_slr_left_join_desc.json ---------------------------------------------------------------------- diff --git a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_with_slr_left_join_desc.json b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_with_slr_left_join_desc.json index bb59a05..a7ffb00 100644 --- a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_with_slr_left_join_desc.json +++ b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_with_slr_left_join_desc.json @@ -5,7 +5,7 @@ "description" : null, "dimensions" : [ { "name" : "CAL_DT", - "table" : "EDW.TEST_CAL_DT", + "table" : "EDW.V_TEST_CAL_DT", "column" : "{FK}", "derived" : [ "WEEK_BEG_DT" ] }, { http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/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 5e25a5b..c6dc832 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 @@ -5,7 +5,7 @@ "description" : null, "dimensions" : [ { "name" : "CAL_DT", - "table" : "EDW.TEST_CAL_DT", + "table" : "EDW.V_TEST_CAL_DT", "column" : "{FK}", "derived" : [ "WEEK_BEG_DT" ] }, { http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/examples/test_case_data/localmeta/invertedindex_desc/test_kylin_ii_left_join_desc.json ---------------------------------------------------------------------- diff --git a/examples/test_case_data/localmeta/invertedindex_desc/test_kylin_ii_left_join_desc.json b/examples/test_case_data/localmeta/invertedindex_desc/test_kylin_ii_left_join_desc.json index 2f152ad..cdb21cd 100644 --- a/examples/test_case_data/localmeta/invertedindex_desc/test_kylin_ii_left_join_desc.json +++ b/examples/test_case_data/localmeta/invertedindex_desc/test_kylin_ii_left_join_desc.json @@ -44,7 +44,7 @@ ] }, { - "table": "edw.test_cal_dt", + "table": "edw.v_test_cal_dt", "columns": [ "cal_dt", "week_beg_dt" http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/examples/test_case_data/localmeta/model_desc/test_kylin_left_join_model_desc.json ---------------------------------------------------------------------- diff --git a/examples/test_case_data/localmeta/model_desc/test_kylin_left_join_model_desc.json b/examples/test_case_data/localmeta/model_desc/test_kylin_left_join_model_desc.json index 1e8a6e9..bc0eced 100644 --- a/examples/test_case_data/localmeta/model_desc/test_kylin_left_join_model_desc.json +++ b/examples/test_case_data/localmeta/model_desc/test_kylin_left_join_model_desc.json @@ -4,7 +4,7 @@ "name": "test_kylin_left_join_model_desc", "lookups": [ { - "table": "EDW.TEST_CAL_DT", + "table": "EDW.V_TEST_CAL_DT", "join": { "type": "left", "primary_key": ["CAL_DT"], @@ -82,7 +82,7 @@ ] }, { - "table": "edw.test_cal_dt", + "table": "edw.v_test_cal_dt", "columns": [ "cal_dt", "week_beg_dt" http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/examples/test_case_data/localmeta/table/EDW.V_TEST_CAL_DT.json ---------------------------------------------------------------------- diff --git a/examples/test_case_data/localmeta/table/EDW.V_TEST_CAL_DT.json b/examples/test_case_data/localmeta/table/EDW.V_TEST_CAL_DT.json new file mode 100644 index 0000000..4463f3d --- /dev/null +++ b/examples/test_case_data/localmeta/table/EDW.V_TEST_CAL_DT.json @@ -0,0 +1,409 @@ +{ + + "uuid" : "0ff420eb-79ad-40bd-bca9-12d8cd05c60a", + "name" : "V_TEST_CAL_DT", + "columns" : [ { + "id" : "1", + "name" : "CAL_DT", + "datatype" : "date" + }, { + "id" : "2", + "name" : "YEAR_BEG_DT", + "datatype" : "date" + }, { + "id" : "3", + "name" : "QTR_BEG_DT", + "datatype" : "date" + }, { + "id" : "4", + "name" : "MONTH_BEG_DT", + "datatype" : "date" + }, { + "id" : "5", + "name" : "WEEK_BEG_DT", + "datatype" : "date" + }, { + "id" : "6", + "name" : "AGE_FOR_YEAR_ID", + "datatype" : "smallint" + }, { + "id" : "7", + "name" : "AGE_FOR_QTR_ID", + "datatype" : "smallint" + }, { + "id" : "8", + "name" : "AGE_FOR_MONTH_ID", + "datatype" : "smallint" + }, { + "id" : "9", + "name" : "AGE_FOR_WEEK_ID", + "datatype" : "smallint" + }, { + "id" : "10", + "name" : "AGE_FOR_DT_ID", + "datatype" : "smallint" + }, { + "id" : "11", + "name" : "AGE_FOR_RTL_YEAR_ID", + "datatype" : "smallint" + }, { + "id" : "12", + "name" : "AGE_FOR_RTL_QTR_ID", + "datatype" : "smallint" + }, { + "id" : "13", + "name" : "AGE_FOR_RTL_MONTH_ID", + "datatype" : "smallint" + }, { + "id" : "14", + "name" : "AGE_FOR_RTL_WEEK_ID", + "datatype" : "smallint" + }, { + "id" : "15", + "name" : "AGE_FOR_CS_WEEK_ID", + "datatype" : "smallint" + }, { + "id" : "16", + "name" : "DAY_OF_CAL_ID", + "datatype" : "int" + }, { + "id" : "17", + "name" : "DAY_OF_YEAR_ID", + "datatype" : "smallint" + }, { + "id" : "18", + "name" : "DAY_OF_QTR_ID", + "datatype" : "smallint" + }, { + "id" : "19", + "name" : "DAY_OF_MONTH_ID", + "datatype" : "smallint" + }, { + "id" : "20", + "name" : "DAY_OF_WEEK_ID", + "datatype" : "int" + }, { + "id" : "21", + "name" : "WEEK_OF_YEAR_ID", + "datatype" : "tinyint" + }, { + "id" : "22", + "name" : "WEEK_OF_CAL_ID", + "datatype" : "int" + }, { + "id" : "23", + "name" : "MONTH_OF_QTR_ID", + "datatype" : "tinyint" + }, { + "id" : "24", + "name" : "MONTH_OF_YEAR_ID", + "datatype" : "tinyint" + }, { + "id" : "25", + "name" : "MONTH_OF_CAL_ID", + "datatype" : "smallint" + }, { + "id" : "26", + "name" : "QTR_OF_YEAR_ID", + "datatype" : "tinyint" + }, { + "id" : "27", + "name" : "QTR_OF_CAL_ID", + "datatype" : "smallint" + }, { + "id" : "28", + "name" : "YEAR_OF_CAL_ID", + "datatype" : "smallint" + }, { + "id" : "29", + "name" : "YEAR_END_DT", + "datatype" : "string" + }, { + "id" : "30", + "name" : "QTR_END_DT", + "datatype" : "string" + }, { + "id" : "31", + "name" : "MONTH_END_DT", + "datatype" : "string" + }, { + "id" : "32", + "name" : "WEEK_END_DT", + "datatype" : "string" + }, { + "id" : "33", + "name" : "CAL_DT_NAME", + "datatype" : "string" + }, { + "id" : "34", + "name" : "CAL_DT_DESC", + "datatype" : "string" + }, { + "id" : "35", + "name" : "CAL_DT_SHORT_NAME", + "datatype" : "string" + }, { + "id" : "36", + "name" : "YTD_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "37", + "name" : "QTD_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "38", + "name" : "MTD_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "39", + "name" : "WTD_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "40", + "name" : "SEASON_BEG_DT", + "datatype" : "string" + }, { + "id" : "41", + "name" : "DAY_IN_YEAR_COUNT", + "datatype" : "smallint" + }, { + "id" : "42", + "name" : "DAY_IN_QTR_COUNT", + "datatype" : "tinyint" + }, { + "id" : "43", + "name" : "DAY_IN_MONTH_COUNT", + "datatype" : "tinyint" + }, { + "id" : "44", + "name" : "DAY_IN_WEEK_COUNT", + "datatype" : "tinyint" + }, { + "id" : "45", + "name" : "RTL_YEAR_BEG_DT", + "datatype" : "string" + }, { + "id" : "46", + "name" : "RTL_QTR_BEG_DT", + "datatype" : "string" + }, { + "id" : "47", + "name" : "RTL_MONTH_BEG_DT", + "datatype" : "string" + }, { + "id" : "48", + "name" : "RTL_WEEK_BEG_DT", + "datatype" : "string" + }, { + "id" : "49", + "name" : "CS_WEEK_BEG_DT", + "datatype" : "string" + }, { + "id" : "50", + "name" : "CAL_DATE", + "datatype" : "string" + }, { + "id" : "51", + "name" : "DAY_OF_WEEK", + "datatype" : "string" + }, { + "id" : "52", + "name" : "MONTH_ID", + "datatype" : "string" + }, { + "id" : "53", + "name" : "PRD_DESC", + "datatype" : "string" + }, { + "id" : "54", + "name" : "PRD_FLAG", + "datatype" : "string" + }, { + "id" : "55", + "name" : "PRD_ID", + "datatype" : "string" + }, { + "id" : "56", + "name" : "PRD_IND", + "datatype" : "string" + }, { + "id" : "57", + "name" : "QTR_DESC", + "datatype" : "string" + }, { + "id" : "58", + "name" : "QTR_ID", + "datatype" : "string" + }, { + "id" : "59", + "name" : "QTR_IND", + "datatype" : "string" + }, { + "id" : "60", + "name" : "RETAIL_WEEK", + "datatype" : "string" + }, { + "id" : "61", + "name" : "RETAIL_YEAR", + "datatype" : "string" + }, { + "id" : "62", + "name" : "RETAIL_START_DATE", + "datatype" : "string" + }, { + "id" : "63", + "name" : "RETAIL_WK_END_DATE", + "datatype" : "string" + }, { + "id" : "64", + "name" : "WEEK_IND", + "datatype" : "string" + }, { + "id" : "65", + "name" : "WEEK_NUM_DESC", + "datatype" : "string" + }, { + "id" : "66", + "name" : "WEEK_BEG_DATE", + "datatype" : "string" + }, { + "id" : "67", + "name" : "WEEK_END_DATE", + "datatype" : "string" + }, { + "id" : "68", + "name" : "WEEK_IN_YEAR_ID", + "datatype" : "string" + }, { + "id" : "69", + "name" : "WEEK_ID", + "datatype" : "string" + }, { + "id" : "70", + "name" : "WEEK_BEG_END_DESC_MDY", + "datatype" : "string" + }, { + "id" : "71", + "name" : "WEEK_BEG_END_DESC_MD", + "datatype" : "string" + }, { + "id" : "72", + "name" : "YEAR_ID", + "datatype" : "string" + }, { + "id" : "73", + "name" : "YEAR_IND", + "datatype" : "string" + }, { + "id" : "74", + "name" : "CAL_DT_MNS_1YEAR_DT", + "datatype" : "string" + }, { + "id" : "75", + "name" : "CAL_DT_MNS_2YEAR_DT", + "datatype" : "string" + }, { + "id" : "76", + "name" : "CAL_DT_MNS_1QTR_DT", + "datatype" : "string" + }, { + "id" : "77", + "name" : "CAL_DT_MNS_2QTR_DT", + "datatype" : "string" + }, { + "id" : "78", + "name" : "CAL_DT_MNS_1MONTH_DT", + "datatype" : "string" + }, { + "id" : "79", + "name" : "CAL_DT_MNS_2MONTH_DT", + "datatype" : "string" + }, { + "id" : "80", + "name" : "CAL_DT_MNS_1WEEK_DT", + "datatype" : "string" + }, { + "id" : "81", + "name" : "CAL_DT_MNS_2WEEK_DT", + "datatype" : "string" + }, { + "id" : "82", + "name" : "CURR_CAL_DT_MNS_1YEAR_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "83", + "name" : "CURR_CAL_DT_MNS_2YEAR_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "84", + "name" : "CURR_CAL_DT_MNS_1QTR_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "85", + "name" : "CURR_CAL_DT_MNS_2QTR_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "86", + "name" : "CURR_CAL_DT_MNS_1MONTH_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "87", + "name" : "CURR_CAL_DT_MNS_2MONTH_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "88", + "name" : "CURR_CAL_DT_MNS_1WEEK_YN_IND", + "datatype" : "tinyint" + }, { + "id" : "89", + "name" : "CURR_CAL_DT_MNS_2WEEK_YN_IND", + "datatype" : "tinyint" + }, { + "id" : "90", + "name" : "RTL_MONTH_OF_RTL_YEAR_ID", + "datatype" : "string" + }, { + "id" : "91", + "name" : "RTL_QTR_OF_RTL_YEAR_ID", + "datatype" : "tinyint" + }, { + "id" : "92", + "name" : "RTL_WEEK_OF_RTL_YEAR_ID", + "datatype" : "tinyint" + }, { + "id" : "93", + "name" : "SEASON_OF_YEAR_ID", + "datatype" : "tinyint" + }, { + "id" : "94", + "name" : "YTM_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "95", + "name" : "YTQ_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "96", + "name" : "YTW_YN_ID", + "datatype" : "tinyint" + }, { + "id" : "97", + "name" : "CRE_DATE", + "datatype" : "string" + }, { + "id" : "98", + "name" : "CRE_USER", + "datatype" : "string" + }, { + "id" : "99", + "name" : "UPD_DATE", + "datatype" : "string" + }, { + "id" : "100", + "name" : "UPD_USER", + "datatype" : "string" + } ], + "database" : "edw", + "table_type" : "VIRTUAL_VIEW", + "last_modified" : 0 +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java index d90ed60..7e5ed0b 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java @@ -153,7 +153,7 @@ public class HiveMRInput implements IMRInput { final String useDatabaseHql = "USE " + conf.getConfig().getHiveDatabaseForIntermediateTable() + ";"; hiveCmdBuilder.addStatement(useDatabaseHql); for(TableDesc lookUpTableDesc : cubeDesc.getLookupTableDescs()) { - if (lookUpTableDesc.isSourceTableHiveView()) { + if (TableDesc.TABLE_TYPE_VIRTUAL_VIEW.equalsIgnoreCase(lookUpTableDesc.getTableType())) { findHiveViewLookUpTable = true; lookUpTableDesc.setHiveViewIntermediateTableNamePrefix("kylin_intermediate_" + jobId); StringBuilder createIntermediateTableHql = new StringBuilder(); http://git-wip-us.apache.org/repos/asf/kylin/blob/f1a332ab/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java ---------------------------------------------------------------------- diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java index 6860f91..33a9ad0 100644 --- a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java +++ b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java @@ -117,10 +117,8 @@ public class HiveSourceTableLoader { tableDesc.setUuid(UUID.randomUUID().toString()); tableDesc.setLastModified(0); } - if(table.getTableType().equals(TableType.VIRTUAL_VIEW.toString())) { - tableDesc.setSourceTableHiveViewFlag(true); - } else { - tableDesc.setSourceTableHiveViewFlag(false); + if(table.getTableType() != null) { + tableDesc.setTableType(table.getTableType()); } int columnNumber = fields.size();