This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch 2.5.0-hadoop3.1
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 715da5f04366a2d9bb74a905158a8b7415d3423b
Author: hit-lacus <hit_la...@126.com>
AuthorDate: Tue Sep 11 18:07:21 2018 +0800

    KYLIN-3525 Reserve intermediate flat table data if 
kylin.source.hive.keep-flat-table set to true
---
 .../apache/kylin/source/hive/GarbageCollectionStep.java   | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git 
a/source-hive/src/main/java/org/apache/kylin/source/hive/GarbageCollectionStep.java
 
b/source-hive/src/main/java/org/apache/kylin/source/hive/GarbageCollectionStep.java
index ac25d07..7dc8260 100644
--- 
a/source-hive/src/main/java/org/apache/kylin/source/hive/GarbageCollectionStep.java
+++ 
b/source-hive/src/main/java/org/apache/kylin/source/hive/GarbageCollectionStep.java
@@ -60,16 +60,17 @@ public class GarbageCollectionStep extends 
AbstractExecutable {
         StringBuffer output = new StringBuffer();
         final HiveCmdBuilder hiveCmdBuilder = new HiveCmdBuilder();
         final List<String> hiveTables = this.getIntermediateTables();
-        for (String hiveTable : hiveTables) {
-            if (config.isHiveKeepFlatTable() == false && 
StringUtils.isNotEmpty(hiveTable)) {
-                hiveCmdBuilder.addStatement("USE " + 
config.getHiveDatabaseForIntermediateTable() + ";");
-                hiveCmdBuilder.addStatement("DROP TABLE IF EXISTS  " + 
hiveTable + ";");
-
-                output.append("Hive table " + hiveTable + " is dropped. \n");
+        if (!config.isHiveKeepFlatTable()){
+            for (String hiveTable : hiveTables) {
+                if (StringUtils.isNotEmpty(hiveTable)) {
+                    hiveCmdBuilder.addStatement("USE " + 
config.getHiveDatabaseForIntermediateTable() + ";");
+                    hiveCmdBuilder.addStatement("DROP TABLE IF EXISTS  " + 
hiveTable + ";");
+                    output.append("Hive table " + hiveTable + " is dropped. 
\n");
+                }
             }
+            rmdirOnHDFS(getExternalDataPaths());
         }
         config.getCliCommandExecutor().execute(hiveCmdBuilder.build());
-        rmdirOnHDFS(getExternalDataPaths());
         output.append("Path " + getExternalDataPaths() + " is deleted. \n");
 
         return output.toString();

Reply via email to