Search in sources :

Example 46 with ExploreException

use of co.cask.cdap.explore.service.ExploreException in project cdap by caskdata.

the class DistributedStorageProviderNamespaceAdmin method delete.

@SuppressWarnings("ConstantConditions")
@Override
public void delete(NamespaceId namespaceId) throws IOException, ExploreException, SQLException {
    // delete namespace directory from filesystem
    super.delete(namespaceId);
    if (NamespaceId.DEFAULT.equals(namespaceId)) {
        return;
    }
    // delete HBase namespace
    NamespaceConfig namespaceConfig;
    try {
        namespaceConfig = namespaceQueryAdmin.get(namespaceId).getConfig();
    } catch (Exception ex) {
        throw new IOException("Could not fetch custom HBase mapping.", ex);
    }
    if (!Strings.isNullOrEmpty(namespaceConfig.getHbaseNamespace())) {
        // custom namespace mapping is set for HBase, hence don't do anything during delete since the lifecycle of the
        // namespace will be managed by the user
        LOG.debug("Custom HBase mapping {} was found while deleting {}. Hence skipping deletion of HBase namespace", namespaceConfig.getHbaseNamespace(), namespaceId);
        return;
    }
    // delete HBase namespace
    String namespace = tableUtil.getHBaseNamespace(namespaceId);
    try (HBaseDDLExecutor executor = hBaseDDLExecutorFactory.get()) {
        executor.deleteNamespaceIfExists(namespace);
    }
}
Also used : NamespaceConfig(co.cask.cdap.proto.NamespaceConfig) HBaseDDLExecutor(co.cask.cdap.spi.hbase.HBaseDDLExecutor) IOException(java.io.IOException) IOException(java.io.IOException) SQLException(java.sql.SQLException) ExploreException(co.cask.cdap.explore.service.ExploreException)

Aggregations

ExploreException (co.cask.cdap.explore.service.ExploreException)46 QueryHandle (co.cask.cdap.proto.QueryHandle)17 SQLException (java.sql.SQLException)15 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)14 HttpResponse (co.cask.common.http.HttpResponse)13 IOException (java.io.IOException)12 OperationHandle (org.apache.hive.service.cli.OperationHandle)12 SessionHandle (org.apache.hive.service.cli.SessionHandle)12 Path (javax.ws.rs.Path)8 UnsupportedTypeException (co.cask.cdap.api.data.schema.UnsupportedTypeException)6 HandleNotFoundException (co.cask.cdap.explore.service.HandleNotFoundException)6 POST (javax.ws.rs.POST)6 DatasetId (co.cask.cdap.proto.id.DatasetId)5 DatasetManagementException (co.cask.cdap.api.dataset.DatasetManagementException)4 BadRequestException (co.cask.cdap.common.BadRequestException)4 TableNotFoundException (co.cask.cdap.explore.service.TableNotFoundException)4 JsonSyntaxException (com.google.gson.JsonSyntaxException)4 PartitionKey (co.cask.cdap.api.dataset.lib.PartitionKey)3 QueryStatus (co.cask.cdap.proto.QueryStatus)3 JsonObject (com.google.gson.JsonObject)3