use of org.apache.iceberg.exceptions.NamespaceNotEmptyException in project hive by apache.
the class HiveCatalog method dropNamespace.
@Override
public boolean dropNamespace(Namespace namespace) {
if (!isValidateNamespace(namespace)) {
return false;
}
try {
clients.run(client -> {
client.dropDatabase(namespace.level(0), false, /* deleteData */
false, /* ignoreUnknownDb */
false);
return null;
});
LOG.info("Dropped namespace: {}", namespace);
return true;
} catch (InvalidOperationException e) {
throw new NamespaceNotEmptyException(e, "Namespace %s is not empty. One or more tables exist.", namespace);
} catch (NoSuchObjectException e) {
return false;
} catch (TException e) {
throw new RuntimeException("Failed to drop namespace " + namespace + " in Hive Matastore", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Interrupted in call to drop dropDatabase(name) " + namespace + " in Hive Matastore", e);
}
}
Aggregations