use of com.amazonaws.services.glue.model.DeleteTableRequest in project presto by prestodb.
the class GlueHiveMetastore method dropTable.
@Override
public void dropTable(MetastoreContext metastoreContext, String databaseName, String tableName, boolean deleteData) {
Table table = getTableOrElseThrow(metastoreContext, databaseName, tableName);
try {
stats.getDeleteTable().record(() -> glueClient.deleteTable(new DeleteTableRequest().withCatalogId(catalogId).withDatabaseName(databaseName).withName(tableName)));
} catch (AmazonServiceException e) {
throw new PrestoException(HIVE_METASTORE_ERROR, e);
}
String tableLocation = table.getStorage().getLocation();
if (deleteData && isManagedTable(table) && !isNullOrEmpty(tableLocation)) {
deleteDir(hdfsContext, hdfsEnvironment, new Path(tableLocation), true);
}
}
Aggregations