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);
}
}
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);
}
}
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!");
}
}
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);
}
}
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);
}
}
Aggregations