@Override
  public boolean dropNamespace(Namespace namespace) throws NamespaceNotEmptyException {
    if (!namespaceExists(namespace)) {
      return false;
    }

    List<TableIdentifier> tableIdentifiers = listTables(namespace);
    if (tableIdentifiers != null && !tableIdentifiers.isEmpty()) {
      throw new NamespaceNotEmptyException(
          "Namespace %s is not empty. %s tables exist.", namespace, tableIdentifiers.size());
    }

    int deletedRows =
        execute(
            JdbcUtil.DELETE_ALL_NAMESPACE_PROPERTIES_SQL,
            catalogName,
            JdbcUtil.namespaceToString(namespace));

    return deletedRows > 0;
  }
@Test
  public void testDropNamespace() {
    assertThat(catalog.dropNamespace(Namespace.of("db", "ns1_not_exitss")))
        .as("Should return false if drop does not modify state")
        .isFalse();

    TableIdentifier tbl0 = TableIdentifier.of("db", "ns1", "ns2", "tbl2");
    TableIdentifier tbl1 = TableIdentifier.of("db", "ns1", "ns2", "tbl1");
    TableIdentifier tbl2 = TableIdentifier.of("db", "ns1", "tbl2");
    TableIdentifier tbl3 = TableIdentifier.of("db", "ns3", "tbl4");
    TableIdentifier tbl4 = TableIdentifier.of("db", "tbl");

    Lists.newArrayList(tbl0, tbl1, tbl2, tbl3, tbl4)
        .forEach(t -> catalog.createTable(t, SCHEMA, PartitionSpec.unpartitioned()));

    assertThatThrownBy(() -> catalog.dropNamespace(tbl1.namespace()))
        .isInstanceOf(NamespaceNotEmptyException.class)
        .hasMessage("Namespace db.ns1.ns2 is not empty. 2 tables exist.");

    assertThatThrownBy(() -> catalog.dropNamespace(tbl2.namespace()))
        .isInstanceOf(NamespaceNotEmptyException.class)
        .hasMessage("Namespace db.ns1 is not empty. 1 tables exist.");

    assertThatThrownBy(() -> catalog.dropNamespace(tbl4.namespace()))
        .isInstanceOf(NamespaceNotEmptyException.class)
        .hasMessage("Namespace db is not empty. 1 tables exist.");
  }