Search in sources :

Example 36 with MetaException

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

the class HBaseStore method getPrimaryKeys.

@Override
public List<SQLPrimaryKey> getPrimaryKeys(String db_name, String tbl_name) throws MetaException {
    boolean commit = false;
    openTransaction();
    try {
        List<SQLPrimaryKey> pk = getHBase().getPrimaryKey(db_name, tbl_name);
        commit = true;
        return pk;
    } catch (IOException e) {
        LOG.error("Unable to get primary key", e);
        throw new MetaException("Error reading db " + e.getMessage());
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : SQLPrimaryKey(org.apache.hadoop.hive.metastore.api.SQLPrimaryKey) IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 37 with MetaException

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

the class HBaseStore method getFileMetadata.

@Override
public ByteBuffer[] getFileMetadata(List<Long> fileIds) throws MetaException {
    openTransaction();
    boolean commit = true;
    try {
        return getHBase().getFileMetadata(fileIds);
    } catch (IOException e) {
        commit = false;
        LOG.error("Unable to get file metadata", e);
        throw new MetaException("Error reading file metadata " + e.getMessage());
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 38 with MetaException

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

the class HBaseStore method writeBackGrantOrRevoke.

private void writeBackGrantOrRevoke(HiveObjectPrivilege priv, PrivilegeInfo pi) throws MetaException, NoSuchObjectException, InvalidObjectException {
    // Now write it back
    switch(priv.getHiveObject().getObjectType()) {
        case GLOBAL:
            try {
                getHBase().putGlobalPrivs(pi.privSet);
            } catch (IOException e) {
                LOG.error("Unable to write global privileges", e);
                throw new MetaException("Unable to write global privileges, " + e.getMessage());
            }
            break;
        case DATABASE:
            pi.db.setPrivileges(pi.privSet);
            alterDatabase(pi.db.getName(), pi.db);
            break;
        case TABLE:
            pi.table.setPrivileges(pi.privSet);
            alterTable(pi.table.getDbName(), pi.table.getTableName(), pi.table);
            break;
        default:
            throw new RuntimeException("Dude, you missed the second switch!");
    }
}
Also used : IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 39 with MetaException

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

the class HBaseStore method getPartitionColumnStatistics.

@Override
public List<ColumnStatistics> getPartitionColumnStatistics(String dbName, String tblName, List<String> partNames, List<String> colNames) throws MetaException, NoSuchObjectException {
    List<List<String>> partVals = new ArrayList<List<String>>(partNames.size());
    for (String partName : partNames) {
        partVals.add(partNameToVals(partName));
    }
    boolean commit = false;
    openTransaction();
    try {
        List<ColumnStatistics> cs = getHBase().getPartitionStatistics(dbName, tblName, partNames, partVals, colNames);
        commit = true;
        return cs;
    } catch (IOException e) {
        LOG.error("Unable to fetch column statistics", e);
        throw new MetaException("Failed fetching column statistics, " + e.getMessage());
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : ColumnStatistics(org.apache.hadoop.hive.metastore.api.ColumnStatistics) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Example 40 with MetaException

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

the class HBaseStore method addMasterKey.

@Override
public int addMasterKey(String key) throws MetaException {
    boolean commit = false;
    openTransaction();
    try {
        long seq = getHBase().getNextSequence(HBaseReadWrite.MASTER_KEY_SEQUENCE);
        getHBase().putMasterKey((int) seq, key);
        commit = true;
        return (int) seq;
    } catch (IOException e) {
        LOG.error("Unable to add master key", e);
        throw new MetaException("Failed adding master key, " + e.getMessage());
    } finally {
        commitOrRoleBack(commit);
    }
}
Also used : IOException(java.io.IOException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Aggregations

MetaException (org.apache.hadoop.hive.metastore.api.MetaException)318 IOException (java.io.IOException)123 ArrayList (java.util.ArrayList)95 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)74 TException (org.apache.thrift.TException)67 Table (org.apache.hadoop.hive.metastore.api.Table)59 Partition (org.apache.hadoop.hive.metastore.api.Partition)57 SQLException (java.sql.SQLException)55 InvalidObjectException (org.apache.hadoop.hive.metastore.api.InvalidObjectException)53 Path (org.apache.hadoop.fs.Path)45 Connection (java.sql.Connection)36 InvalidOperationException (org.apache.hadoop.hive.metastore.api.InvalidOperationException)34 AlreadyExistsException (org.apache.hadoop.hive.metastore.api.AlreadyExistsException)32 Statement (java.sql.Statement)31 Test (org.junit.Test)30 List (java.util.List)25 Database (org.apache.hadoop.hive.metastore.api.Database)25 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)25 ResultSet (java.sql.ResultSet)22 UnknownDBException (org.apache.hadoop.hive.metastore.api.UnknownDBException)22