{"record":{"id":"eb3ee35fcf2f624b","repo":"prestodb/presto","slug":"not-supported-eb3ee3","errorCode":"NOT_SUPPORTED","errorMessage":"Table has no columns: ","messagePattern":"Table has no columns: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/metadata/MetadataManager.java","lineNumber":580,"sourceCode":"        return new PartitioningHandle(Optional.of(connectorId), Optional.of(transaction), connectorPartitioningHandle);\n    }\n\n    @Override\n    public Optional<Object> getInfo(Session session, TableHandle handle)\n    {\n        ConnectorId connectorId = handle.getConnectorId();\n        ConnectorMetadata metadata = getMetadata(session, connectorId);\n        return handle.getLayout().flatMap(tableLayout -> metadata.getInfo(tableLayout));\n    }\n\n    @Override\n    public TableMetadata getTableMetadata(Session session, TableHandle tableHandle)\n    {\n        ConnectorId connectorId = tableHandle.getConnectorId();\n        ConnectorMetadata metadata = getMetadata(session, connectorId);\n        ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle());\n        if (tableMetadata.getColumns().isEmpty()) {\n            throw new PrestoException(NOT_SUPPORTED, \"Table has no columns: \" + tableHandle);\n        }\n\n        return new TableMetadata(connectorId, tableMetadata);\n    }\n\n    @Override\n    public TableStatistics getTableStatistics(Session session, TableHandle tableHandle, List<ColumnHandle> columnHandles, Constraint<ColumnHandle> constraint)\n    {\n        try {\n            ConnectorId connectorId = tableHandle.getConnectorId();\n            ConnectorMetadata metadata = getMetadata(session, connectorId);\n            return session.getRuntimeStats().recordWallTime(\n                    GET_TABLE_STATISTICS_TIME_NANOS,\n                    () -> metadata.getTableStatistics(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle(), tableHandle.getLayout(), columnHandles, constraint));\n        }\n        catch (RuntimeException e) {\n            if (isIgnoreStatsCalculatorFailures(session)) {\n                log.error(e, \"Error occurred when computing stats for query %s\", session.getQueryId());","sourceCodeStart":562,"sourceCodeEnd":598,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/metadata/MetadataManager.java#L562-L598","documentation":"MetadataManager.getTableMetadata fetches a table's metadata from its connector and validates it. A connector returning a column list that is empty is treated as structurally invalid — Presto requires every table to expose at least one column — so it throws NOT_SUPPORTED with the table handle. This guards downstream planning from zero-column tables.","triggerScenarios":"getTableMetadata called with a TableHandle whose connector's getTableMetadata returns ConnectorTableMetadata with an empty columns list — typically a connector bug or a corrupted/externally-modified metastore entry.","commonSituations":"Custom connectors that don't map hidden/synthetic columns correctly; external table definitions deleted/emptied in the metastore; connector version bugs returning empty columns for certain table types (e.g. views or transient tables).","solutions":["Inspect the table definition in the underlying catalog/metastore and re-add at least one column","Fix the connector's getTableMetadata to always return the column list (including hidden columns if appropriate)","Drop and recreate the table if its metadata is unrecoverable","Upgrade or patch the connector plugin that produced the empty column list"],"exampleFix":"// before\nnew ConnectorTableMetadata(tableName, ImmutableList.of()); // empty columns\n// after\nnew ConnectorTableMetadata(tableName, columns); // must contain >=1 column","handlingStrategy":"try-catch","validationCode":"// Validate the connector's table metadata before planning:\nConnectorTableMetadata md = connectorMetadata.getTableMetadata(cs, handle.getConnectorHandle());\nif (md.getColumns().isEmpty()) throw new IllegalStateException(\"Connector returned zero columns for \" + handle);","typeGuard":"boolean hasColumns(ConnectorTableMetadata md) { return !md.getColumns().isEmpty(); }","tryCatchPattern":"try { tm = metadataManager.getTableMetadata(session, handle); }\ncatch (PrestoException e) { if (NOT_SUPPORTED.getCode() == e.getErrorCode() && e.getMessage().startsWith(\"Table has no columns\")) { /* recreate table or report connector bug */ } else throw e; }","preventionTips":["Keep connectors returning full column lists including hidden columns","Monitor metastore health; a zero-column definition usually means corruption","Patch/upgrade connectors known to emit empty columns for certain table types"],"tags":["presto","metadata","connector-bug"],"backgroundTag":"table-has-no-columns","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"}