Search in sources :

Example 96 with MetaException

use of org.apache.hadoop.hive.metastore.api.MetaException in project hive by apache.

the class HBaseStore method getPartitions.

@Override
public List<Partition> getPartitions(String dbName, String tableName, int max) throws MetaException, NoSuchObjectException {
    boolean commit = false;
    openTransaction();
    try {
        List<Partition> parts = getHBase().scanPartitionsInTable(HiveStringUtils.normalizeIdentifier(dbName), HiveStringUtils.normalizeIdentifier(tableName), max);
        commit = true;
        return parts;
    } catch (IOException e) {
        LOG.error("Unable to get partitions", e);
        throw new MetaException("Error scanning partitions");
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 97 with MetaException

use of org.apache.hadoop.hive.metastore.api.MetaException in project hive by apache.

the class HBaseStore method listPartitionNames.

@Override
public List<String> listPartitionNames(String db_name, String tbl_name, short max_parts) throws MetaException {
    boolean commit = false;
    openTransaction();
    try {
        List<Partition> parts = getHBase().scanPartitionsInTable(HiveStringUtils.normalizeIdentifier(db_name), HiveStringUtils.normalizeIdentifier(tbl_name), max_parts);
        if (parts == null)
            return null;
        List<String> names = new ArrayList<String>(parts.size());
        Table table = getHBase().getTable(HiveStringUtils.normalizeIdentifier(db_name), HiveStringUtils.normalizeIdentifier(tbl_name));
        for (Partition p : parts) {
            names.add(buildExternalPartName(table, p));
        }
        commit = true;
        return names;
    } catch (IOException e) {
        LOG.error("Unable to get partitions", e);
        throw new MetaException("Error scanning partitions");
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : Partition(org.apache.hadoop.hive.metastore.api.Partition) Table(org.apache.hadoop.hive.metastore.api.Table) ArrayList(java.util.ArrayList) IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 98 with MetaException

use of org.apache.hadoop.hive.metastore.api.MetaException in project hive by apache.

the class HBaseStore method getTableColumnStatistics.

@Override
public ColumnStatistics getTableColumnStatistics(String dbName, String tableName, List<String> colName) throws MetaException, NoSuchObjectException {
    boolean commit = false;
    openTransaction();
    try {
        ColumnStatistics cs = getHBase().getTableStatistics(dbName, tableName, colName);
        commit = true;
        return cs;
    } catch (IOException e) {
        LOG.error("Unable to fetch column statistics", e);
        throw new MetaException("Failed to fetch column statistics, " + e.getMessage());
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : ColumnStatistics(org.apache.hadoop.hive.metastore.api.ColumnStatistics) IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 99 with MetaException

use of org.apache.hadoop.hive.metastore.api.MetaException in project hive by apache.

the class HBaseStore method dropFunction.

@Override
public void dropFunction(String dbName, String funcName) throws MetaException, NoSuchObjectException, InvalidObjectException, InvalidInputException {
    boolean commit = false;
    openTransaction();
    try {
        getHBase().deleteFunction(dbName, funcName);
        commit = true;
    } catch (IOException e) {
        LOG.error("Unable to delete function" + e);
        throw new MetaException("Unable to read from or write to hbase " + e.getMessage());
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 100 with MetaException

use of org.apache.hadoop.hive.metastore.api.MetaException in project hive by apache.

the class HBaseStore method addRole.

@Override
public boolean addRole(String roleName, String ownerName) throws InvalidObjectException, MetaException, NoSuchObjectException {
    int now = (int) (System.currentTimeMillis() / 1000);
    Role role = new Role(roleName, now, ownerName);
    boolean commit = false;
    openTransaction();
    try {
        if (getHBase().getRole(roleName) != null) {
            throw new InvalidObjectException("Role " + roleName + " already exists");
        }
        getHBase().putRole(role);
        commit = true;
        return true;
    } catch (IOException e) {
        LOG.error("Unable to create role ", e);
        throw new MetaException("Unable to read from or write to hbase " + e.getMessage());
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : Role(org.apache.hadoop.hive.metastore.api.Role) InvalidObjectException(org.apache.hadoop.hive.metastore.api.InvalidObjectException) IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Aggregations

MetaException (org.apache.hadoop.hive.metastore.api.MetaException)232 IOException (java.io.IOException)97 ArrayList (java.util.ArrayList)66 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)55 TException (org.apache.thrift.TException)50 Table (org.apache.hadoop.hive.metastore.api.Table)43 Partition (org.apache.hadoop.hive.metastore.api.Partition)37 InvalidObjectException (org.apache.hadoop.hive.metastore.api.InvalidObjectException)33 Path (org.apache.hadoop.fs.Path)32 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)21 Database (org.apache.hadoop.hive.metastore.api.Database)20 SQLException (java.sql.SQLException)19 List (java.util.List)19 InvalidOperationException (org.apache.hadoop.hive.metastore.api.InvalidOperationException)18 AlreadyExistsException (org.apache.hadoop.hive.metastore.api.AlreadyExistsException)17 StorageDescriptor (org.apache.hadoop.hive.metastore.api.StorageDescriptor)17 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)17 HashMap (java.util.HashMap)16 UnknownDBException (org.apache.hadoop.hive.metastore.api.UnknownDBException)15 Connection (java.sql.Connection)14