Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
shendanfeng committed Nov 3, 2023
1 parent e5b9f5e commit 29284a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,8 @@ public static void getTableList(Context ctx) {
}
for (TableIdentifier tableIdentifier : tableIdentifiers) {
TableMeta tableMeta = new TableMeta(tableIdentifier.getTableName(), TableMeta.TableType.ARCTIC.toString());
if (tempTables.contains(tableMeta)) {
tables.add(tableMeta);
tempTables.remove(tableMeta);
}
tables.add(tableMeta);
tempTables.remove(tableMeta);
}
tables.addAll(tempTables);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,20 @@ public void dropDatabase(String databaseName) {

@Override
protected void doDropTable(TableMeta meta, boolean purge) {
// drop hive table operation will only delete hive table metadata
// delete data files operation will use BasicArcticCatalog
try {
hiveClientPool.run(client -> {
client.dropTable(meta.getTableIdentifier().getDatabase(),
meta.getTableIdentifier().getTableName(),
false /* deleteData */,
false /* ignoreUnknownTab */);
return null;
});
} catch (TException | InterruptedException e) {
throw new RuntimeException("Failed to drop table:" + meta.getTableIdentifier(), e);
if (HiveTableUtil.checkExist(hiveClientPool, TableIdentifier.of(meta.getTableIdentifier()))) {
// drop hive table operation will only delete hive table metadata
// delete data files operation will use BasicArcticCatalog
try {
hiveClientPool.run(client -> {
client.dropTable(meta.getTableIdentifier().getDatabase(),
meta.getTableIdentifier().getTableName(),
false /* deleteData */,
false /* ignoreUnknownTab */);
return null;
});
} catch (TException | InterruptedException e) {
throw new RuntimeException("Failed to drop table:" + meta.getTableIdentifier(), e);
}
}
super.doDropTable(meta, purge);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static StorageDescriptor storageDescriptor(
* @param tableIdentifier A table identifier
* @return If table is existed in hive
*/
public boolean checkExist(HMSClientPool hiveClient, TableIdentifier tableIdentifier) {
public static boolean checkExist(HMSClientPool hiveClient, TableIdentifier tableIdentifier) {
String database = tableIdentifier.getDatabase();
String name = tableIdentifier.getTableName();
try {
Expand Down

0 comments on commit 29284a8

Please sign in to comment.