use of org.apache.hadoop.hive.metastore.api.MetaException in project hive by apache.
the class HBaseStore method addPartitions.
@Override
public boolean addPartitions(String dbName, String tblName, List<Partition> parts) throws InvalidObjectException, MetaException {
boolean commit = false;
openTransaction();
try {
List<Partition> partsCopy = new ArrayList<Partition>();
for (int i = 0; i < parts.size(); i++) {
Partition partCopy = parts.get(i).deepCopy();
partCopy.setDbName(HiveStringUtils.normalizeIdentifier(partCopy.getDbName()));
partCopy.setTableName(HiveStringUtils.normalizeIdentifier(partCopy.getTableName()));
partsCopy.add(i, partCopy);
}
getHBase().putPartitions(partsCopy);
commit = true;
return true;
} catch (IOException e) {
LOG.error("Unable to add partitions", 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 addIndex.
@Override
public boolean addIndex(Index index) throws InvalidObjectException, MetaException {
boolean commit = false;
openTransaction();
try {
index.setDbName(HiveStringUtils.normalizeIdentifier(index.getDbName()));
index.setOrigTableName(HiveStringUtils.normalizeIdentifier(index.getOrigTableName()));
index.setIndexName(HiveStringUtils.normalizeIdentifier(index.getIndexName()));
index.setIndexTableName(HiveStringUtils.normalizeIdentifier(index.getIndexTableName()));
getHBase().putIndex(index);
commit = true;
} catch (IOException e) {
LOG.error("Unable to create index ", e);
throw new MetaException("Unable to read from or write to hbase " + e.getMessage());
} finally {
commitOrRoleBack(commit);
}
return commit;
}
use of org.apache.hadoop.hive.metastore.api.MetaException in project hive by apache.
the class HBaseStore method getPartition.
@Override
public Partition getPartition(String dbName, String tableName, List<String> part_vals) throws MetaException, NoSuchObjectException {
boolean commit = false;
openTransaction();
try {
Partition part = getHBase().getPartition(HiveStringUtils.normalizeIdentifier(dbName), HiveStringUtils.normalizeIdentifier(tableName), part_vals);
if (part == null) {
throw new NoSuchObjectException("Unable to find partition " + partNameForErrorMsg(dbName, tableName, part_vals));
}
commit = true;
return part;
} catch (IOException e) {
LOG.error("Unable to get partition", e);
throw new MetaException("Error reading partition " + e.getMessage());
} finally {
commitOrRoleBack(commit);
}
}
use of org.apache.hadoop.hive.metastore.api.MetaException in project hive by apache.
the class HBaseStore method updateMasterKey.
@Override
public void updateMasterKey(Integer seqNo, String key) throws NoSuchObjectException, MetaException {
boolean commit = false;
openTransaction();
try {
if (getHBase().getMasterKey(seqNo) == null) {
throw new NoSuchObjectException("No key found with keyId: " + seqNo);
}
getHBase().putMasterKey(seqNo, key);
commit = true;
} catch (IOException e) {
LOG.error("Unable to update master key", e);
throw new MetaException("Failed updating master key, " + e.getMessage());
} finally {
commitOrRoleBack(commit);
}
}
use of org.apache.hadoop.hive.metastore.api.MetaException in project hive by apache.
the class HBaseStore method getTableMeta.
@Override
public List<TableMeta> getTableMeta(String dbNames, String tableNames, List<String> tableTypes) throws MetaException {
boolean commit = false;
openTransaction();
try {
List<TableMeta> metas = new ArrayList<>();
for (String dbName : getDatabases(dbNames)) {
for (Table table : getTableObjectsByName(dbName, getTableNamesInTx(dbName, tableNames))) {
if (tableTypes == null || tableTypes.contains(table.getTableType())) {
TableMeta metaData = new TableMeta(table.getDbName(), table.getTableName(), table.getTableType());
metaData.setComments(table.getParameters().get("comment"));
metas.add(metaData);
}
}
}
commit = true;
return metas;
} catch (Exception e) {
LOG.error("Unable to get tables ", e);
throw new MetaException("Unable to get tables, " + e.getMessage());
} finally {
commitOrRoleBack(commit);
}
}
Aggregations