prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Table type not supported: ${tableType}

What it means

FileHiveMetastore.createTable only supports VIRTUAL_VIEW, MANAGED_TABLE, MATERIALIZED_VIEW, and EXTERNAL_TABLE table types. Any other TableType falls through to the else branch and raises NOT_SUPPORTED naming the type.

Source

Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/file/FileHiveMetastore.java:265

        // validate table location
        if (table.getTableType().equals(VIRTUAL_VIEW)) {
            checkArgument(table.getStorage().getLocation().isEmpty(), "Storage location for view must be empty");
        }
        else if (table.getTableType().equals(MANAGED_TABLE) || table.getTableType().equals(MATERIALIZED_VIEW)) {
            if (!tableMetadataDirectory.equals(new Path(table.getStorage().getLocation()))) {
                throw new PrestoException(HIVE_METASTORE_ERROR, "Table directory must be " + tableMetadataDirectory);
            }
        }
        else if (table.getTableType().equals(EXTERNAL_TABLE)) {
            try {
                validateExternalLocation(new Path(table.getStorage().getLocation()), catalogDirectory);
            }
            catch (IOException e) {
                throw new PrestoException(HIVE_METASTORE_ERROR, "Could not validate external location", e);
            }
        }
        else {
            throw new PrestoException(NOT_SUPPORTED, "Table type not supported: " + table.getTableType());
        }

        if (!table.getTableType().equals(VIRTUAL_VIEW)) {
            try {
                Path tableLocation = new Path(table.getStorage().getLocation());
                FileSystem fileSystem = hdfsEnvironment.getFileSystem(hdfsContext, tableLocation);
                if (!fileSystem.isDirectory(tableLocation)) {
                    throw new PrestoException(HIVE_METASTORE_ERROR, "Table location is not a directory: " + tableLocation);
                }
                if (!fileSystem.exists(tableLocation)) {
                    throw new PrestoException(HIVE_METASTORE_ERROR, "Table directory does not exist: " + tableLocation);
                }
            }
            catch (IOException e) {
                throw new PrestoException(HIVE_METASTORE_ERROR, "Could not validate table location", e);
            }
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Change the table to one of the supported types (MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW, MATERIALIZED_VIEW) before calling createTable.
  2. Exclude unsupported table types during import/migration and log them for manual handling.
  3. Upgrade Presto if the type is newly supported in later releases.

Example fix

// before
table.setTableType(INDEX_TABLE);
metastore.createTable(metastoreContext, table, privileges, null);
// after
table.setTableType(EXTERNAL_TABLE);
metastore.createTable(metastoreContext, table, privileges, null);
Defensive patterns

Strategy: type-guard

Validate before calling

Set<TableType> supported = ImmutableSet.of(VIRTUAL_VIEW, MANAGED_TABLE, MATERIALIZED_VIEW, EXTERNAL_TABLE);
if (!supported.contains(table.getTableType())) {
    throw new IllegalArgumentException("Unsupported table type for file metastore: " + table.getTableType());
}

Type guard

boolean isSupportedTableType(Table t) {
    return ImmutableSet.of(VIRTUAL_VIEW, MANAGED_TABLE, MATERIALIZED_VIEW, EXTERNAL_TABLE).contains(t.getTableType());
}

Try / catch

try {
    metastore.createTable(metastoreContext, table, privileges, constraints);
} catch (PrestoException e) {
    if (e.getErrorCode() == NOT_SUPPORTED.toErrorCode()) {
        // fall back to EXTERNAL_TABLE or skip and record the unsupported type
    } else { throw e; }
}

Prevention

When it happens

Trigger: Passing a Table with an unusual TableType (e.g. INDEX_TABLE, TEMPORARY_TABLE variants, or a type added by a newer Hive) to createTable via the metastore API.

Common situations: Migration tools importing Hive metadata with auxiliary table types; plugins building tables with exotic types; version skew where a newer metastore client emits types this Presto build doesn't know.

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/64965f740af08b96. Report an issue: GitHub.