KYLIN-2165 skip redistribute if row count is 0

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

Branch: refs/heads/KYLIN-2006
Commit: 408f9d43d309eedf19361f0a701213214e436cdd
Parents: dc1866a
Author: shaofengshi <shaofeng...@apache.org>
Authored: Tue Nov 8 14:26:53 2016 +0800
Committer: shaofengshi <shaofeng...@apache.org>
Committed: Tue Nov 8 14:26:53 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/source/hive/HiveMRInput.java    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/408f9d43/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 67ceffc..9e9dc25 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
@@ -282,9 +282,13 @@ public class HiveMRInput implements IMRInput {
             try {
                 long rowCount = computeRowCount(database, tableName);
                 logger.debug("Row count of table '" + intermediateTable + "' 
is " + rowCount);
-                if (!config.isEmptySegmentAllowed() && rowCount == 0) {
-                    stepLogger.log("Detect upstream hive table is empty, " + 
"fail the job because \"kylin.job.allow.empty.segment\" = \"false\"");
-                    return new ExecuteResult(ExecuteResult.State.ERROR, 
stepLogger.getBufferedLog());
+                if (rowCount == 0) {
+                    if (!config.isEmptySegmentAllowed()) {
+                        stepLogger.log("Detect upstream hive table is empty, " 
+ "fail the job because \"kylin.job.allow.empty.segment\" = \"false\"");
+                        return new ExecuteResult(ExecuteResult.State.ERROR, 
stepLogger.getBufferedLog());
+                    } else {
+                        return new ExecuteResult(ExecuteResult.State.SUCCEED, 
"Row count is 0, no need to redistribute");
+                    }
                 }
 
                 int mapperInputRows = config.getHadoopJobMapperInputRows();

Reply via email to