{"record":{"id":"fd6a515fa3c5052b","repo":"prestodb/presto","slug":"accumulo-table-exists","errorCode":"ACCUMULO_TABLE_EXISTS","errorMessage":"Cannot create internal table when an Accumulo table already exists","messagePattern":"Cannot create internal table when an Accumulo table already exists","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java","lineNumber":262,"sourceCode":"            }\n\n            // If the number of matched columns does not equal the defined size,\n            // then a column was specified that does not exist\n            // (or there is a duplicate column in the table DDL, which is also an issue but has been checked before in validateColumns).\n            if (matchingColumns != g.getValue().size()) {\n                throw new PrestoException(INVALID_TABLE_PROPERTY, \"Unknown Presto column defined for locality group \" + g.getKey());\n            }\n        }\n    }\n\n    private void validateInternalTable(ConnectorTableMetadata meta)\n    {\n        String table = AccumuloTable.getFullTableName(meta.getTable());\n        String indexTable = Indexer.getIndexTableName(meta.getTable());\n        String metricsTable = Indexer.getMetricsTableName(meta.getTable());\n\n        if (tableManager.exists(table)) {\n            throw new PrestoException(ACCUMULO_TABLE_EXISTS, \"Cannot create internal table when an Accumulo table already exists\");\n        }\n\n        if (AccumuloTableProperties.getIndexColumns(meta.getProperties()).isPresent()) {\n            if (tableManager.exists(indexTable) || tableManager.exists(metricsTable)) {\n                throw new PrestoException(ACCUMULO_TABLE_EXISTS, \"Internal table is indexed, but the index table and/or index metrics table(s) already exist\");\n            }\n        }\n    }\n\n    /**\n     * Gets the row ID based on a table properties or the first column name.\n     *\n     * @param meta ConnectorTableMetadata\n     * @return Lowercase Presto column name mapped to the Accumulo row ID\n     */\n    private static String getRowIdColumn(ConnectorTableMetadata meta)\n    {\n        Optional<String> rowIdColumn = AccumuloTableProperties.getRowId(meta.getProperties());","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java#L244-L280","documentation":"Resource groups form a tree; only leaf groups may directly receive queries. InternalResourceGroup.run checks subGroups and throws INVALID_RESOURCE_GROUP ('Cannot add queries to %s. It is not a leaf group.') when a query is routed to a group that still has children, because interior groups only aggregate their descendants.","triggerScenarios":"A selector or configuration-manager match() returns a resource group id that is defined as a parent (has subgroups in resource-groups.properties), so enqueueQuery/run is invoked on an interior group.","commonSituations":"Misconfigured selectors pointing at parent group names (e.g. 'global' or 'global.adhoc' when 'global.adhoc.*' leaves exist); renaming leaf groups so old selectors now hit a parent; template/config-manager (file/DB) rules out of sync with the group tree.","solutions":["Update selectors so matched patterns point at leaf resource groups (groups with no subgroups).","Check resource-groups.properties: ensure the id the selector matches is declared without children, or add the query's attributes so it falls into a leaf.","If using a dynamic configuration manager, sync its exported group ids with the actual group tree and redeploy.","Restart/reload the catalog after fixing configuration so selectors and groups are consistent."],"exampleFix":"# before (selector matches a parent)\nresource-groups.selector.0.source=.*\nresource-groups.selector.0.group=global\n# after — match a leaf\nresource-groups.selector.0.source=.*\nresource-groups.selector.0.group=global.adhoc.pipeline","handlingStrategy":"validation","validationCode":"SHOW CREATE TABLE <db>.<tbl>;","typeGuard":null,"tryCatchPattern":"try {\n    getFields(...);\n} catch (PrestoException e) {\n    if (e.getErrorCode().equals(HiveErrorCode.HIVE_INVALID_METADATA.toErrorCode())) {\n        // repair or recreate table\n    } else { throw e; }\n}","preventionTips":["Never hand-edit metastore RDBMS rows","Monitor for failed/interrupted DDL","Keep and test metastore backups","Alert on HIVE_INVALID_METADATA"],"tags":["presto","resource-groups","configuration","scheduling"],"backgroundTag":"resource-group-not-leaf","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"}