prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Views are not enabled. You can enable views by setting 'bigquery.views-enabled' to true. Notice additional cost may occur.

What it means

ReadSessionCreator.getActualTable only supports reading views when config.viewsEnabled is true; otherwise encountering a BigQuery VIEW table type throws NOT_SUPPORTED with instructions to enable 'bigquery.views-enabled'. The connector reads views by materializing them into destination tables, which incurs extra cost, hence the opt-in.

Source

Thrown at presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/ReadSessionCreator.java:114

                            .build());

            return readSession;
        }
    }

    TableInfo getActualTable(
            TableInfo table,
            ImmutableList<String> requiredColumns,
            String[] filters)
    {
        TableDefinition tableDefinition = table.getDefinition();
        TableDefinition.Type tableType = tableDefinition.getType();
        if (TableDefinition.Type.TABLE == tableType) {
            return table;
        }
        if (TableDefinition.Type.VIEW == tableType) {
            if (!config.viewsEnabled) {
                throw new PrestoException(NOT_SUPPORTED,
                        "Views are not enabled. You can enable views by setting 'bigquery.views-enabled' to true. Notice additional cost may occur.");
            }
            // get it from the view
            String querySql = bigQueryClient.createSql(table.getTableId(), requiredColumns);
            log.debug("querySql is %s", querySql);
            try {
                return destinationTableCache.get(querySql, new DestinationTableBuilder(bigQueryClient, config, querySql, table.getTableId()));
            }
            catch (ExecutionException e) {
                throw new PrestoException(BigQueryErrorCode.BIGQUERY_VIEW_DESTINATION_TABLE_CREATION_FAILED, "Error creating destination table", e);
            }
        }
        else {
            // not regular table or a view
            throw new PrestoException(NOT_SUPPORTED, format("Table type '%s' of table '%s.%s' is not supported",
                    tableType, table.getTableId().getDataset(), table.getTableId().getTable()));
        }
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set bigquery.views-enabled=true in the catalog properties file and restart/reload the connector
  2. Query the underlying base tables directly instead of the view
  3. Materialize the view yourself as a table in BigQuery
  4. Confirm you are querying the intended catalog (a non-BigQuery catalog may support views natively)

Example fix

// before (bigquery.properties)
# views not configured
// after
bigquery.views-enabled=true
Defensive patterns

Strategy: validation

Validate before calling

// check table type and config before querying a view
TableInfo table = bigQueryClient.getTable(tableId);
boolean viewsEnabled = Boolean.parseBoolean(catalogProperties.getProperty("bigquery.views-enabled", "false"));
if (table.getDefinition().getType() == TableDefinition.Type.VIEW && !viewsEnabled) {
    throw new IllegalStateException("Enable bigquery.views-enabled=true to query views");
}

Type guard

boolean isQueryableTable(TableDefinition def, boolean viewsEnabled) {
    return def.getType() == TableDefinition.Type.TABLE
        || (def.getType() == TableDefinition.Type.VIEW && viewsEnabled);
}

Try / catch

try {
    return query.execute();
} catch (PrestoException e) {
    if (e.getErrorCode() == NOT_SUPPORTED && e.getMessage().contains("views-enabled")) {
        // guide user: set bigquery.views-enabled=true or query base tables
    }
    throw e;
}

Prevention

When it happens

Trigger: Querying a BigQuery view (or a table whose type resolves to VIEW) while the catalog config does not set bigquery.views-enabled=true.

Common situations: Users selecting from views without knowing the connector treats views specially; default catalog config; migrating workloads that previously used views.

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