{"record":{"id":"8fd0396ac4661bca","repo":"prestodb/presto","slug":"accumulo-table-exists-8fd039","errorCode":"ACCUMULO_TABLE_EXISTS","errorMessage":"Accumulo table already exists","messagePattern":"Accumulo table already exists","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloTableManager.java","lineNumber":90,"sourceCode":"            LOG.warn(\"NamespaceExistsException suppressed when creating \" + schema);\n        }\n    }\n\n    public boolean exists(String table)\n    {\n        return connector.tableOperations().exists(table);\n    }\n\n    public void createAccumuloTable(String table)\n    {\n        try {\n            connector.tableOperations().create(table);\n        }\n        catch (AccumuloException | AccumuloSecurityException e) {\n            throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, \"Failed to create Accumulo table\", e);\n        }\n        catch (TableExistsException e) {\n            throw new PrestoException(ACCUMULO_TABLE_EXISTS, \"Accumulo table already exists\", e);\n        }\n    }\n\n    public void setLocalityGroups(String tableName, Map<String, Set<Text>> groups)\n    {\n        if (groups.isEmpty()) {\n            return;\n        }\n\n        try {\n            connector.tableOperations().setLocalityGroups(tableName, groups);\n            LOG.debug(\"Set locality groups for %s to %s\", tableName, groups);\n        }\n        catch (AccumuloException | AccumuloSecurityException e) {\n            throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, \"Failed to set locality groups\", e);\n        }\n        catch (TableNotFoundException e) {\n            throw new PrestoException(ACCUMULO_TABLE_DNE, \"Failed to set locality groups, table does not exist\", e);","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloTableManager.java#L72-L108","documentation":"In createAccumuloTable, when Accumulo throws TableExistsException the connector converts it to ACCUMULO_TABLE_EXISTS 'Accumulo table already exists', signaling that the physical Accumulo table of that name is already present and cannot be created again.","triggerScenarios":"Presto CREATE TABLE (or createAccumuloTable called directly) when a table with the same namespace.table name already exists in Accumulo — e.g. a leftover physical table not tracked in the connector metadata, or a duplicate creation racing another session.","commonSituations":"Previous CREATE TABLE partially failed leaving the Accumulo table but no catalog entry; two concurrent creations of the same table name; repointing Presto at a cluster where the table already exists; case/name collisions.","solutions":["If the existing Accumulo table is stale/orphaned, delete it in the Accumulo shell ('droptable namespace.table') and retry the Presto CREATE.","If the table is valid and already in use, skip creation — the data is already there; verify with 'tables list'.","Use a different table name to avoid the collision.","Serialize DDL so concurrent sessions don't create the same table simultaneously."],"exampleFix":"// Accumulo shell — remove orphaned physical table left by failed CREATE:\ndroptable myschema.orders\n// then in Presto:\nCREATE TABLE myschema.orders (...);","handlingStrategy":"validation","validationCode":"// Check for the physical table before creating:\nString qualified = schema + \".\" + table;\nif (conn.tableOperations().exists(qualified)) {\n  // drop if orphaned, or skip creation and proceed\n}","typeGuard":null,"tryCatchPattern":"try {\n  tableManager.createAccumuloTable(qualified);\n} catch (PrestoException e) {\n  if (e.getErrorCode().getName().equals(\"ACCUMULO_TABLE_EXISTS\")) {\n    // inspect the existing table: drop if orphaned, otherwise treat creation as done\n  }\n  throw e;\n}","preventionTips":["Check tableOperations().exists() before issuing CREATE TABLE.","Serialize DDL across sessions to avoid duplicate concurrent creations.","After failed CREATE TABLE runs, clean up orphaned physical Accumulo tables.","Keep Presto metadata and physical Accumulo tables in sync (drop both sides together)."],"tags":["accumulo","table-exists","ddl","conflict"],"backgroundTag":"table-already-exists","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}