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 2017/02/16 00:52:50 UTC

[02/17] kylin git commit: minor, add scan-whole-table flag in TableDesc

minor, add scan-whole-table flag in TableDesc

Signed-off-by: shaofengshi <sh...@apache.org>


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

Branch: refs/heads/master-hbase0.98
Commit: c93ea9c9cb70c285e9b5ce69be3b7b435220ad91
Parents: 405dee2
Author: Cheng Wang <ch...@kyligence.io>
Authored: Mon Feb 13 16:03:05 2017 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Mon Feb 13 18:54:10 2017 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/metadata/model/TableDesc.java  | 16 +++++++++++++---
 .../org/apache/kylin/source/hive/HiveMRInput.java   |  5 +++--
 2 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/c93ea9c9/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 e4fc4c3..be62062 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
@@ -26,8 +26,8 @@ import org.apache.kylin.common.persistence.RootPersistentEntity;
 import org.apache.kylin.common.util.StringSplitter;
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 /**
@@ -46,9 +46,11 @@ public class TableDesc extends RootPersistentEntity implements ISourceAware {
     private ColumnDesc[] columns;
     @JsonProperty("source_type")
     private int sourceType = ISourceAware.ID_HIVE;
+    @JsonProperty("whole_scan")
+    private boolean wholeScan = true;
     @JsonProperty("table_type")
     private String tableType;
-    
+
     @JsonProperty("data_gen")
     @JsonInclude(JsonInclude.Include.NON_NULL)
     private String dataGen;
@@ -101,7 +103,15 @@ public class TableDesc extends RootPersistentEntity implements ISourceAware {
         }
         return identity;
     }
-    
+
+    public void setWholeScan(boolean wholeScan) {
+        this.wholeScan = wholeScan;
+    }
+
+    public boolean getWholeScan() {
+        return this.wholeScan;
+    }
+
     public boolean isView() {
         return TABLE_TYPE_VIRTUAL_VIEW.equals(tableType);
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/c93ea9c9/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 d665dc7..f9c7cfc 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
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.Set;
 
-import com.google.common.collect.Sets;
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -57,10 +56,12 @@ import org.apache.kylin.metadata.model.TableDesc;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.Sets;
+
 public class HiveMRInput implements IMRInput {
 
     public static String getTableNameForHCat(TableDesc table) {
-        String tableName = table.isView() ? table.getMaterializedName() : table.getName();
+        String tableName = (table.isView() || !table.getWholeScan()) ? table.getMaterializedName() : table.getName();
         return String.format("%s.%s", table.getDatabase(), tableName).toUpperCase();
     }