prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Table rename is not yet supported by Glue service

What it means

GlueHiveMetastore.renameTable unconditionally throws NOT_SUPPORTED because the AWS Glue Data Catalog API does not expose a table rename operation (a Glue table is keyed by database+name, and renaming requires create+delete which could lose state). This is a hard capability gap of the backend, not a validation failure in Presto.

Source

Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/glue/GlueHiveMetastore.java:851

                            .databaseName(databaseName)
                            .tableInput(newTableInput.toBuilder().parameters(statisticsParameters).build())
                            .build(),
                    stats.getUpdateTable());

            return EMPTY_RESULT;
        }
        catch (EntityNotFoundException e) {
            throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
        }
        catch (AwsServiceException e) {
            throw new PrestoException(HIVE_METASTORE_ERROR, e);
        }
    }

    @Override
    public MetastoreOperationResult renameTable(MetastoreContext metastoreContext, String databaseName, String tableName, String newDatabaseName, String newTableName)
    {
        throw new PrestoException(NOT_SUPPORTED, "Table rename is not yet supported by Glue service");
    }

    @Override
    public MetastoreOperationResult addColumn(MetastoreContext metastoreContext, String databaseName, String tableName, String columnName, HiveType columnType, String columnComment)
    {
        software.amazon.awssdk.services.glue.model.Table table = getGlueTableOrElseThrow(databaseName, tableName);
        ImmutableList.Builder<software.amazon.awssdk.services.glue.model.Column> newDataColumns = ImmutableList.builder();
        newDataColumns.addAll(table.storageDescriptor().columns());
        newDataColumns.add(convertColumn(new Column(columnName, columnType, Optional.ofNullable(columnComment), Optional.empty())));
        StorageDescriptor newStorageDescriptor = table.storageDescriptor().toBuilder().columns(newDataColumns.build()).build();
        replaceGlueTable(databaseName, tableName, table.toBuilder().storageDescriptor(newStorageDescriptor).build());
        return EMPTY_RESULT;
    }

    @Override
    public MetastoreOperationResult renameColumn(MetastoreContext metastoreContext, String databaseName, String tableName, String oldColumnName, String newColumnName)
    {
        software.amazon.awssdk.services.glue.model.Table table = getGlueTableOrElseThrow(databaseName, tableName);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use CREATE TABLE ... AS SELECT (or CREATE TABLE LIKE + INSERT) into the new table name, then drop the old table.
  2. Use external tooling (AWS CLI/Glue console/UpdateTable + CreateTable/DeleteTable) to perform create-new, copy-data, drop-old explicitly.
  3. Restructure the workflow to avoid renames — e.g. write directly to the final table name.
  4. If only the location/schema changed, consider Glue UpdateTable instead of a rename.

Example fix

// before
metastore.renameTable(context, "db", "old_t", "db", "new_t"); // throws on Glue
// after
// CREATE TABLE db.new_t AS SELECT * FROM db.old_t; then DROP TABLE db.old_t;
runner.executeSessionSql("CREATE TABLE db.new_t AS SELECT * FROM db.old_t");
runner.executeSessionSql("DROP TABLE db.old_t");
Defensive patterns

Strategy: fallback

Validate before calling

// Feature-check the backend capability before planning a rename:
// if the metastore is GlueHiveMetastore (or backend is 'glue'), treat renameTable as unavailable.

Type guard

boolean supportsTableRename = !(metastore instanceof GlueHiveMetastore);
if (!supportsTableRename) { useCtasFallback(db, oldTable, newTable); }

Try / catch

try {
    metastore.renameTable(ctx, db, oldName, db, newName);
}
catch (PrestoException e) {
    if (e.getErrorCode().getName().equals("NOT_SUPPORTED")) {
        ctasThenDrop(db, oldName, newName); // CREATE TABLE new AS SELECT + DROP old
    } else { throw e; }
}

Prevention

When it happens

Trigger: ALTER TABLE ... RENAME TO or any call to Metastore.renameTable on a table stored in the Glue Data Catalog; migration tooling calling renameTable to move a table between Glue databases.

Common situations: Users migrating from Hive metastore (where rename works) to Glue; CI/CD pipelines that rename tables as part of blue/green deployments; cross-database table moves assumed to be supported.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.

Related errors


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