Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,14 @@ public AccumuloClient(

// The default namespace is created in ZooKeeperMetadataManager's constructor
if (!tableManager.namespaceExists(DEFAULT_SCHEMA)) {
tableManager.createNamespace(DEFAULT_SCHEMA);
try {
tableManager.createNamespace(DEFAULT_SCHEMA);
}
catch (TrinoException e) {
if (!e.getErrorCode().equals(ALREADY_EXISTS.toErrorCode())) {
throw e;
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import static io.trino.plugin.accumulo.AccumuloErrorCode.ACCUMULO_TABLE_DNE;
import static io.trino.plugin.accumulo.AccumuloErrorCode.ACCUMULO_TABLE_EXISTS;
import static io.trino.plugin.accumulo.AccumuloErrorCode.UNEXPECTED_ACCUMULO_ERROR;
import static io.trino.spi.StandardErrorCode.ALREADY_EXISTS;
import static java.util.Objects.requireNonNull;

/**
Expand All @@ -58,7 +59,10 @@ public void createNamespace(String schema)
try {
connector.namespaceOperations().create(schema);
}
catch (AccumuloException | AccumuloSecurityException | NamespaceExistsException e) {
catch (NamespaceExistsException e) {
throw new TrinoException(ALREADY_EXISTS, "Namespace already exists: " + schema, e);
}
catch (AccumuloException | AccumuloSecurityException e) {
throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to create Accumulo namespace: " + schema, e);
}
}
Expand Down