prestodb/presto · error · UnknownTableTypeException
Not a Hive table:
Error message
Not a Hive table:
What it means
getTableMetadata throws UnknownTableTypeException (message "Not a Hive table: ...") when the metastore table is detected as an Iceberg or Delta Lake table, since those must be accessed through their own connectors. A missing table or virtual view throws TableNotFoundException instead.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java:703
Optional<Table> table = metastore.getTable(metastoreContext, hiveTableHandle);
return getTableMetadata(table, hiveTableHandle.getSchemaTableName(), metastoreContext, session);
}
private ConnectorTableMetadata getTableMetadata(ConnectorSession session, SchemaTableName tableName)
{
MetastoreContext metastoreContext = getMetastoreContext(session);
Optional<Table> table = metastore.getTable(metastoreContext, tableName.getSchemaName(), tableName.getTableName());
return getTableMetadata(table, tableName, metastoreContext, session);
}
private ConnectorTableMetadata getTableMetadata(Optional<Table> table, SchemaTableName tableName, MetastoreContext metastoreContext, ConnectorSession session)
{
if (!table.isPresent() || table.get().getTableType().equals(VIRTUAL_VIEW)) {
throw new TableNotFoundException(tableName);
}
if (isIcebergTable(table.get()) || isDeltaLakeTable(table.get())) {
throw new UnknownTableTypeException("Not a Hive table: " + tableName);
}
List<TableConstraint<String>> tableConstraints = metastore.getTableConstraints(metastoreContext, tableName.getSchemaName(), tableName.getTableName());
List<String> notNullColumns = tableConstraints.stream()
.filter(NotNullConstraint.class::isInstance)
.map(constraint -> constraint.getColumns().stream()
.findFirst()
.orElseThrow(() -> new PrestoException(HIVE_METASTORE_ERROR, format("NOT NULL constraint found with no column in table %s", tableName.getTableName()))))
.collect(toImmutableList());
Function<HiveColumnHandle, ColumnMetadata> metadataGetter = columnMetadataGetter(table.get(), typeManager, metastoreContext.getColumnConverter(), notNullColumns);
ImmutableList.Builder<ColumnMetadata> columns = ImmutableList.builder();
Map<String, ColumnHandle> columnNameToHandleAssignments = new HashMap<>();
for (HiveColumnHandle columnHandle : hiveColumnHandles(table.get())) {
columns.add(metadataGetter.apply(columnHandle));
columnNameToHandleAssignments.put(columnHandle.getName(), columnHandle);
}
// External location propertyView on GitHub (pinned to 55bb57d202)
Solutions
- Register and query the table through the Iceberg or Delta Lake connector/catalog instead
- Verify the table's format (input/output format properties) and recreate as a true Hive table if Hive access is required
- Check your catalog configuration in etc/catalog/*.properties to route the table to the correct connector
Example fix
-- before: querying iceberg table via hive catalog SELECT * FROM hive.default.iceberg_tbl; -- after SELECT * FROM iceberg.default.iceberg_tbl;
Defensive patterns
Strategy: validation
Validate before calling
Table t = metastore.getTable(...);
if (t == null || VIRTUAL_VIEW.equals(t.getTableType())) {
throw new IllegalStateException("table missing or is a view");
}
if (isIcebergTable(t) || isDeltaLakeTable(t)) {
throw new IllegalStateException("Use the iceberg/delta catalog for " + tableName);
} Try / catch
try {
// hive catalog query
} catch (UnknownTableTypeException e) {
// retry against iceberg/delta catalog
} Prevention
- Route Iceberg/Delta tables to their own catalogs in catalog configuration
- Check a table's input/output format before querying it via the Hive catalog
- Standardize table formats per database/schema to avoid mixed-format surprises
When it happens
Trigger: Querying or resolving metadata for a table that exists in the metastore but was created as an Iceberg or Delta Lake table while connected through the Hive connector.
Common situations: Catalog misconfiguration (pointing the Hive connector at Iceberg/Delta tables); after migrating a table's format without updating the catalog; environments where table format is mixed within one metastore database.
Related errors
- Not an Iceberg table: ${getSchemaTableName()}
- Expected all parameters to be named type, but got %s
- NOT_FOUND
- GENERIC_INTERNAL_ERROR
- HIVE_INVALID_ENCRYPTION_METADATA
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/1a171ae45643f99e.
Report an issue: GitHub.