shaofengshi closed pull request #154: KYLIN-3388 remove create redistribute flat hive table step if not set… URL: https://github.com/apache/kylin/pull/154
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java b/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java index 57e1c40f60..a6c6daad71 100644 --- a/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java +++ b/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java @@ -189,11 +189,7 @@ public static void appendJoinStatement(IJoinedFlatTableDesc flatDesc, StringBuil } private static void appendDistributeStatement(StringBuilder sql, TblColRef redistCol) { - if (redistCol != null) { - sql.append(" DISTRIBUTE BY ").append(colName(redistCol, true)).append(";\n"); - } else { - sql.append(" DISTRIBUTE BY RAND()").append(";\n"); - } + sql.append(" DISTRIBUTE BY ").append(colName(redistCol, true)).append(";\n"); } private static void appendClusterStatement(StringBuilder sql, TblColRef clusterCol) { 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 0e791ebe86..8653500b98 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 @@ -23,7 +23,6 @@ import java.util.List; import java.util.Set; -import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; @@ -59,6 +58,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.collect.Lists; import com.google.common.collect.Sets; public class HiveMRInput implements IMRInput { @@ -153,7 +153,9 @@ public void addStepPhase1_CreateFlatTable(DefaultChainedExecutable jobFlow) { // then count and redistribute if (cubeConfig.isHiveRedistributeEnabled()) { - jobFlow.addTask(createRedistributeFlatHiveTableStep(hiveInitStatements, cubeName)); + if (flatDesc.getClusterBy() != null || flatDesc.getDistributedBy() != null) { + jobFlow.addTask(createRedistributeFlatHiveTableStep(hiveInitStatements, cubeName)); + } } // special for hive @@ -449,8 +451,7 @@ private String cleanUpIntermediateFlatTable(KylinConfig config) throws IOExcepti } config.getCliCommandExecutor().execute(hiveCmdBuilder.build()); rmdirOnHDFS(getExternalDataPaths()); - output.append( - "Path " + getExternalDataPaths() + " is deleted. \n"); + output.append("Path " + getExternalDataPaths() + " is deleted. \n"); return output.toString(); } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services