Skip to content

Commit

Permalink
KYLIN-3525 Reserve intermediate flat table data if kylin.source.hive.…
Browse files Browse the repository at this point in the history
…keep-flat-table set to true
  • Loading branch information
hit-lacus authored and shaofengshi committed Sep 12, 2018
1 parent 3f7b42a commit 375acde
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ private String cleanUpIntermediateFlatTable(KylinConfig config) throws IOExcepti
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();
Expand Down

0 comments on commit 375acde

Please sign in to comment.