List of usage examples for com.amazonaws.services.glue.model DeletePartitionRequest DeletePartitionRequest
DeletePartitionRequest
From source file:com.facebook.presto.hive.metastore.glue.GlueHiveMetastore.java
License:Apache License
@Override public void dropPartition(String databaseName, String tableName, List<String> parts, boolean deleteData) { Table table = getTableOrElseThrow(databaseName, tableName); Partition partition = getPartition(databaseName, tableName, parts).orElseThrow( () -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), parts)); try {/*from w w w . j a v a 2 s . c o m*/ glueClient.deletePartition(new DeletePartitionRequest().withDatabaseName(databaseName) .withTableName(tableName).withPartitionValues(parts)); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } String partLocation = partition.getStorage().getLocation(); if (deleteData && isManagedTable(table) && !isNullOrEmpty(partLocation)) { deleteDir(hdfsContext, hdfsEnvironment, new Path(partLocation), true); } }