use of org.apache.accumulo.core.client.TableExistsException in project gora by apache.
the class AccumuloStore method createSchema.
@Override
public void createSchema() throws GoraException {
try {
conn.tableOperations().create(mapping.tableName);
Set<Entry<String, String>> es = mapping.tableConfig.entrySet();
for (Entry<String, String> entry : es) {
conn.tableOperations().setProperty(mapping.tableName, entry.getKey(), entry.getValue());
}
} catch (TableExistsException e) {
LOG.debug(e.getMessage(), e);
// Assume this is not an error
} catch (AccumuloException | AccumuloSecurityException e) {
throw new GoraException(e);
}
}
use of org.apache.accumulo.core.client.TableExistsException in project hive by apache.
the class AccumuloStorageHandler method preCreateTable.
@Override
public void preCreateTable(Table table) throws MetaException {
if (table.getSd().getLocation() != null) {
throw new MetaException("Location can't be specified for Accumulo");
}
Map<String, String> serdeParams = table.getSd().getSerdeInfo().getParameters();
String columnMapping = serdeParams.get(AccumuloSerDeParameters.COLUMN_MAPPINGS);
if (columnMapping == null) {
throw new MetaException(AccumuloSerDeParameters.COLUMN_MAPPINGS + " missing from SERDEPROPERTIES");
}
try {
String tblName = getTableName(table);
Connector connector = connectionParams.getConnector();
TableOperations tableOpts = connector.tableOperations();
// Attempt to create the table, taking EXTERNAL into consideration
if (!tableOpts.exists(tblName)) {
tableOpts.create(tblName);
}
String idxTable = getIndexTableName(table);
if (idxTable != null && !idxTable.isEmpty()) {
// create the index table if it does not exist
if (!tableOpts.exists(idxTable)) {
tableOpts.create(idxTable);
}
}
} catch (AccumuloSecurityException e) {
throw new MetaException(StringUtils.stringifyException(e));
} catch (TableExistsException e) {
throw new MetaException(StringUtils.stringifyException(e));
} catch (AccumuloException e) {
throw new MetaException(StringUtils.stringifyException(e));
}
}
Aggregations