log.debug("Dropping %s", tableName);
final Optional<TableHandle> tableHandle = metadataManager.getTableHandle(tableName);
checkState(tableHandle.isPresent(), "Table %s does not exist", tableName);
if (!(tableHandle.get() instanceof NativeTableHandle)) {
throw new PrestoException(CANNOT_DROP_TABLE, "Can only drop native tables");
}
Set<TablePartition> partitions = shardManager.getPartitions(tableHandle.get());
for (TablePartition partition : partitions) {
shardManager.dropPartition(tableHandle.get(), partition.getPartitionName());