apache/beam · error · UnsupportedOperationException

Creating tables is not supported with DataCatalog table prov

Error message

Creating tables is not supported with DataCatalog table provider.

What it means

The DataCatalog table provider is read-only: it resolves table metadata from Google Cloud DataCatalog but cannot register new tables. createTable() unconditionally throws UnsupportedOperationException. DDL like CREATE TABLE against this provider is rejected.

Source

Thrown at sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogTableProvider.java:93

    this.dataCatalog = dataCatalog;
    this.tableFactory =
        ChainedTableFactory.of(
            PUBSUB_TABLE_FACTORY, GCS_TABLE_FACTORY, new BigQueryTableFactory(truncateTimestamps));
  }

  public static DataCatalogTableProvider create(DataCatalogPipelineOptions options) {
    return new DataCatalogTableProvider(
        createDataCatalogClient(options), options.getTruncateTimestamps());
  }

  @Override
  public String getTableType() {
    return "google.cloud.datacatalog";
  }

  @Override
  public void createTable(Table table) {
    throw new UnsupportedOperationException(
        "Creating tables is not supported with DataCatalog table provider.");
  }

  @Override
  public void dropTable(String tableName) {
    throw new UnsupportedOperationException(
        "Dropping tables is not supported with DataCatalog table provider");
  }

  @Override
  public Map<String, Table> getTables() {
    throw new UnsupportedOperationException("Loading all tables from DataCatalog is not supported");
  }

  @Override
  public @Nullable Table getTable(String tableName) {
    return loadTable(tableName);
  }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Pre-create the table in BigQuery and attach a schema in DataCatalog instead of creating it through Beam.
  2. Use a writable provider (e.g. bigquery provider) for CREATE TABLE operations.
  3. Remove the CREATE TABLE step; query the DataCatalog-registered table directly with SELECT.

Example fix

// before
String sql = "CREATE EXTERNAL TABLE t (...) TYPE 'google.cloud.datacatalog'";

// after
// register the table (with schema) in DataCatalog / BigQuery first, then:
String sql = "SELECT * FROM t"; // resolved via datacatalog provider
Defensive patterns

Strategy: validation

Validate before calling

if ("google.cloud.datacatalog".equals(provider.getTableType())) {
  throw new IllegalStateException("createTable is not supported; pre-create the table in BigQuery/DataCatalog");
}

Try / catch

try {
  provider.createTable(table);
} catch (UnsupportedOperationException e) {
  // create table in BigQuery/GCP APIs instead
}

Prevention

When it happens

Trigger: Executing CREATE TABLE / BeamSql.createTable against a BeamSqlEnv configured with the datacatalog provider, or calling provider.createTable(table) directly.

Common situations: Running Beam SQL pipelines with `CREATE EXTERNAL TABLE ... TYPE google.cloud.datacatalog` or attempting to provision tables via this provider; users assume catalog providers can write back to the catalog.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/3eb65d2db8e59d7a. Report an issue: GitHub.