{"record":{"id":"7517ebbacc3021d1","repo":"prestodb/presto","slug":"not-an-iceberg-table","errorCode":null,"errorMessage":"Not an Iceberg table: ","messagePattern":"Not an Iceberg table: ","errorType":"exception","errorClass":"UnknownTableTypeException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java","lineNumber":276,"sourceCode":"                columns,\n                tableProperties,\n                comment);\n\n        return Optional.of(new IcebergViewMetadata(table.getParameters(), tableMetadata));\n    }\n\n    @Override\n    protected boolean tableExists(ConnectorSession session, SchemaTableName schemaTableName)\n    {\n        Optional<Table> hiveTable = getHiveTable(session, schemaTableName);\n        if (!hiveTable.isPresent()) {\n            return false;\n        }\n        if (isPrestoView(hiveTable.get())) {\n            return false;\n        }\n        if (!isIcebergTable(hiveTable.get())) {\n            throw new UnknownTableTypeException(\"Not an Iceberg table: \" + schemaTableName);\n        }\n        return true;\n    }\n\n    private Optional<Table> getHiveTable(ConnectorSession session, SchemaTableName schemaTableName)\n    {\n        IcebergTableName name = IcebergTableName.from(schemaTableName.getTableName());\n        return metastore.getTable(getMetastoreContext(session), schemaTableName.getSchemaName(), name.getTableName());\n    }\n\n    @Override\n    public List<String> listSchemaNames(ConnectorSession session)\n    {\n        return metastore.getAllDatabases(getMetastoreContext(session));\n    }\n\n    @Override\n    public Map<String, Object> getSchemaProperties(ConnectorSession session, CatalogSchemaName schemaName)","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java#L258-L294","documentation":"tableExists() in IcebergHiveMetadata checks whether a metastore table is an Iceberg table. If the Hive table exists in the metastore but is NOT an Iceberg table (and not a Presto view), Presto throws UnknownTableTypeException to signal the table exists but is managed by a different connector (e.g. native Hive). This prevents the Iceberg connector from silently operating on a foreign table.","triggerScenarios":"Calling any Iceberg catalog/describe/query operation on a table that exists in the Hive metastore but was created by the Hive connector or another engine; the isIcebergTable(hiveTable.get()) check fails because table properties lack the Iceberg metadata pointers.","commonSituations":"Migrating tables between Hive and Iceberg connectors; pointing the Iceberg connector at a schema containing legacy Hive tables; a table was dropped and recreated as a plain Hive table; misconfigured catalog so a query lands on the wrong connector.","solutions":["Verify the table is actually an Iceberg table (has 'table_type'='ICEBERG' or metadata_location property) via SHOW CREATE TABLE in the Hive connector","Query the table through the correct connector/catalog (e.g. hive.<schema>.<table> instead of iceberg.<schema>.<table>)","If the table should be Iceberg, migrate it with a proper Hive-to-Iceberg migration tool rather than querying it directly","If the table is stale/leftover, drop it from the metastore with the owning connector and recreate as Iceberg"],"exampleFix":"// before\nSELECT * FROM iceberg.sales.orders; -- UnknownTableTypeException\n// after\nSELECT * FROM hive.sales.orders; -- route to the owning connector","handlingStrategy":"validation","validationCode":"-- Before querying via the Iceberg catalog, confirm ownership:\nSHOW TABLES FROM hive.<schema>;  -- if the table lives here, use the hive catalog\nSELECT * FROM system.metadata.table_comments WHERE schema_name='<schema>';","typeGuard":"// Java-side guard mirroring the connector logic\nboolean isIcebergTable(io.prestodb.spi.connector.ConnectorTableHandle handle) {\n    return handle instanceof IcebergTableHandle;\n}","tryCatchPattern":"try {\n    connection.createStatement().executeQuery(\"SELECT * FROM iceberg.sales.orders\");\n} catch (SQLException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Not an Iceberg table\")) {\n        // reroute to hive catalog or migrate the table\n    } else { throw e; }\n}","preventionTips":["Keep table ownership unambiguous: one connector per table lifecycle","Run SHOW CREATE TABLE via the owning catalog before cross-catalog queries","Document which schemas are Iceberg-managed vs Hive-managed","After migrations, verify table_type properties before switching catalog routes"],"tags":["iceberg","hive-metastore","table-type-mismatch"],"backgroundTag":"unknown-table-type","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}