prestodb/presto · error · PrestoException

ACCUMULO_TABLE_EXISTS

ACCUMULO_TABLE_EXISTS

Error message

Cannot create internal table when an Accumulo table already exists

What it means

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.

Solutions

  1. Update selectors so matched patterns point at leaf resource groups (groups with no subgroups).
  2. 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.
  3. If using a dynamic configuration manager, sync its exported group ids with the actual group tree and redeploy.
  4. Restart/reload the catalog after fixing configuration so selectors and groups are consistent.

Example fix

# before (selector matches a parent)
resource-groups.selector.0.source=.*
resource-groups.selector.0.group=global
# after — match a leaf
resource-groups.selector.0.source=.*
resource-groups.selector.0.group=global.adhoc.pipeline
Defensive patterns

Strategy: validation

Validate before calling

SHOW CREATE TABLE <db>.<tbl>;

Try / catch

try {
    getFields(...);
} catch (PrestoException e) {
    if (e.getErrorCode().equals(HiveErrorCode.HIVE_INVALID_METADATA.toErrorCode())) {
        // repair or recreate table
    } else { throw e; }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/fd6a515fa3c5052b. Report an issue: GitHub.

Appendix: source

Thrown at presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java:262

            }

            // If the number of matched columns does not equal the defined size,
            // then a column was specified that does not exist
            // (or there is a duplicate column in the table DDL, which is also an issue but has been checked before in validateColumns).
            if (matchingColumns != g.getValue().size()) {
                throw new PrestoException(INVALID_TABLE_PROPERTY, "Unknown Presto column defined for locality group " + g.getKey());
            }
        }
    }

    private void validateInternalTable(ConnectorTableMetadata meta)
    {
        String table = AccumuloTable.getFullTableName(meta.getTable());
        String indexTable = Indexer.getIndexTableName(meta.getTable());
        String metricsTable = Indexer.getMetricsTableName(meta.getTable());

        if (tableManager.exists(table)) {
            throw new PrestoException(ACCUMULO_TABLE_EXISTS, "Cannot create internal table when an Accumulo table already exists");
        }

        if (AccumuloTableProperties.getIndexColumns(meta.getProperties()).isPresent()) {
            if (tableManager.exists(indexTable) || tableManager.exists(metricsTable)) {
                throw new PrestoException(ACCUMULO_TABLE_EXISTS, "Internal table is indexed, but the index table and/or index metrics table(s) already exist");
            }
        }
    }

    /**
     * Gets the row ID based on a table properties or the first column name.
     *
     * @param meta ConnectorTableMetadata
     * @return Lowercase Presto column name mapped to the Accumulo row ID
     */
    private static String getRowIdColumn(ConnectorTableMetadata meta)
    {
        Optional<String> rowIdColumn = AccumuloTableProperties.getRowId(meta.getProperties());

View on GitHub (pinned to 55bb57d202)