prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Table has no columns: 

What it means

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.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/metadata/MetadataManager.java:580

        return new PartitioningHandle(Optional.of(connectorId), Optional.of(transaction), connectorPartitioningHandle);
    }

    @Override
    public Optional<Object> getInfo(Session session, TableHandle handle)
    {
        ConnectorId connectorId = handle.getConnectorId();
        ConnectorMetadata metadata = getMetadata(session, connectorId);
        return handle.getLayout().flatMap(tableLayout -> metadata.getInfo(tableLayout));
    }

    @Override
    public TableMetadata getTableMetadata(Session session, TableHandle tableHandle)
    {
        ConnectorId connectorId = tableHandle.getConnectorId();
        ConnectorMetadata metadata = getMetadata(session, connectorId);
        ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle());
        if (tableMetadata.getColumns().isEmpty()) {
            throw new PrestoException(NOT_SUPPORTED, "Table has no columns: " + tableHandle);
        }

        return new TableMetadata(connectorId, tableMetadata);
    }

    @Override
    public TableStatistics getTableStatistics(Session session, TableHandle tableHandle, List<ColumnHandle> columnHandles, Constraint<ColumnHandle> constraint)
    {
        try {
            ConnectorId connectorId = tableHandle.getConnectorId();
            ConnectorMetadata metadata = getMetadata(session, connectorId);
            return session.getRuntimeStats().recordWallTime(
                    GET_TABLE_STATISTICS_TIME_NANOS,
                    () -> metadata.getTableStatistics(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle(), tableHandle.getLayout(), columnHandles, constraint));
        }
        catch (RuntimeException e) {
            if (isIgnoreStatsCalculatorFailures(session)) {
                log.error(e, "Error occurred when computing stats for query %s", session.getQueryId());

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the table definition in the underlying catalog/metastore and re-add at least one column
  2. Fix the connector's getTableMetadata to always return the column list (including hidden columns if appropriate)
  3. Drop and recreate the table if its metadata is unrecoverable
  4. Upgrade or patch the connector plugin that produced the empty column list

Example fix

// before
new ConnectorTableMetadata(tableName, ImmutableList.of()); // empty columns
// after
new ConnectorTableMetadata(tableName, columns); // must contain >=1 column
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate the connector's table metadata before planning:
ConnectorTableMetadata md = connectorMetadata.getTableMetadata(cs, handle.getConnectorHandle());
if (md.getColumns().isEmpty()) throw new IllegalStateException("Connector returned zero columns for " + handle);

Type guard

boolean hasColumns(ConnectorTableMetadata md) { return !md.getColumns().isEmpty(); }

Try / catch

try { tm = metadataManager.getTableMetadata(session, handle); }
catch (PrestoException e) { if (NOT_SUPPORTED.getCode() == e.getErrorCode() && e.getMessage().startsWith("Table has no columns")) { /* recreate table or report connector bug */ } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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).

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