prestodb/presto · error · PrestoException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
Unexpected table present in Hive metastore:
What it means
getTableHandle looks up tables in the Hive metastore; system tables (identified via getSourceTableNameFromSystemTable) must never be resolved as regular connector tables because permission checks (SystemTableAwareAccessControl.checkCanSelectFromTable) depend on them being routed separately. If such a table name is nonetheless present in the metastore, NOT_SUPPORTED is thrown.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java:566
if (database.isPresent()) {
return getDatabaseProperties(database.get());
}
throw new SchemaNotFoundException(schemaName.getSchemaName());
}
@Override
public HiveTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
{
requireNonNull(tableName, "tableName is null");
MetastoreContext metastoreContext = getMetastoreContext(session);
Optional<Table> table = metastore.getTable(metastoreContext, tableName.getSchemaName(), tableName.getTableName());
if (!table.isPresent()) {
return null;
}
if (getSourceTableNameFromSystemTable(tableName).isPresent()) {
// We must not allow system table due to how permissions are checked in SystemTableAwareAccessControl.checkCanSelectFromTable()
throw new PrestoException(NOT_SUPPORTED, "Unexpected table present in Hive metastore: " + tableName);
}
if (!isOfflineDataDebugModeEnabled(session)) {
verifyOnline(tableName, Optional.empty(), getProtectMode(table.get()), table.get().getParameters());
}
return new HiveTableHandle(tableName.getSchemaName(), tableName.getTableName());
}
@Override
public ConnectorTableHandle getTableHandleForStatisticsCollection(ConnectorSession session, SchemaTableName tableName, Map<String, Object> analyzeProperties)
{
HiveTableHandle handle = getTableHandle(session, tableName);
if (handle == null) {
return null;
}
Optional<List<List<String>>> partitionValuesList = getPartitionList(analyzeProperties);
ConnectorTableMetadata tableMetadata = getTableMetadata(session, handle);View on GitHub (pinned to 55bb57d202)
Solutions
- Rename or drop the offending table from the Hive metastore so its name no longer collides with a system table name
- Query the actual system table through the proper system schema instead of the base connector
- Avoid creating Hive tables using reserved system-table naming patterns
Example fix
-- before: a metastore table named like a system table, e.g. "orders$partitions" -- after ALTER TABLE `orders$partitions` RENAME TO `orders_partitions_meta`;
Defensive patterns
Strategy: validation
Validate before calling
if (getSourceTableNameFromSystemTable(tableName).isPresent()) {
throw new IllegalArgumentException("Use the system catalog, not the hive catalog, for: " + tableName);
} Type guard
boolean isRegularHiveTable(SchemaTableName name) {
return getSourceTableNameFromSystemTable(name).isEmpty();
} Try / catch
try {
// metadata/table handle lookup
} catch (PrestoException e) {
if (e.getErrorCode().getCode() == StandardErrorCode.NOT_SUPPORTED.toErrorCode().getCode()) {
// reroute to the proper system catalog/schema
} else throw e;
} Prevention
- Never create Hive tables whose names contain the system-table separator (e.g. '$')
- Filter metastore listings to exclude system-table-shaped names before resolving
- Query system tables via their dedicated system schema
When it happens
Trigger: Calling getTableHandle (via handle/sourceTableHandle paths) with a SchemaTableName that matches a Hive system-table naming pattern and is actually present in the metastore.
Common situations: Users manually creating tables whose names collide with Presto's system table naming convention; migration/backup restores that recreated system-table-named entries; tooling that dumps and reimports metastore tables indiscriminately.
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
- NOT_SUPPORTED
- NOT_SUPPORTED
- HIVE_INVALID_METADATA
- SCHEMA_NOT_EMPTY
- HIVE_UNSUPPORTED_ENCRYPTION_OPERATION
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/3a093d5f5c934d48.
Report an issue: GitHub.