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