Example usage for com.amazonaws.services.glue.model DeleteTableRequest DeleteTableRequest

List of usage examples for com.amazonaws.services.glue.model DeleteTableRequest DeleteTableRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.glue.model DeleteTableRequest DeleteTableRequest.

Prototype

DeleteTableRequest

Source Link

Usage

From source file:com.facebook.presto.hive.metastore.glue.GlueHiveMetastore.java

License:Apache License

@Override
public void dropTable(String databaseName, String tableName, boolean deleteData) {
    Table table = getTableOrElseThrow(databaseName, tableName);

    try {/*from   ww  w.  ja  va  2  s .co  m*/
        glueClient.deleteTable(new DeleteTableRequest().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);
    }
}