apache/beam · error · UnsupportedOperationException

Creating tables in HCatalog is not supported

Error message

Creating tables in HCatalog is not supported

What it means

The HCatalogTableProvider (top-level catalog for hcatalog table type) rejects DDL: createTable throws UnsupportedOperationException because tables must be defined in the Hive metastore, not via Beam SQL.

Solutions

  1. Create tables in Hive/HCatalog before referencing them in Beam SQL.
  2. Guard framework code so it doesn't call createTable on read-only providers.
  3. Use a provider type that supports DDL for table creation workflows.

Example fix

// before
provider.createTable(tblSpec);
// after
// issue HiveQL DDL via Hive metastore client first, then query from Beam
Defensive patterns

Strategy: validation

Validate before calling

if (provider instanceof HCatalogTableProvider && creatingTables) {
  throw new IllegalArgumentException("Create tables in Hive metastore first");
}

Try / catch

try {
  provider.createTable(table);
} catch (UnsupportedOperationException e) {
  // run DDL via Hive/metastore client instead
}

Prevention

When it happens

Trigger: Calling createTable(Table) on HCatalogTableProvider, e.g. when a CREATE TABLE statement targets an hcatalog catalog.

Common situations: Same as 1232 but at the top-level provider: DDL scripts ported from other providers; framework code that generically calls createTable on any TableProvider.

Related errors


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

Appendix: source

Thrown at sdks/java/extensions/sql/hcatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/hcatalog/HCatalogTableProvider.java:69

    this.metastoreSchema = metastoreSchema;
  }

  public static HCatalogTableProvider create(Map<String, String> configuration) {
    HCatalogBeamSchema metastoreSchema = HCatalogBeamSchema.create(configuration);
    return new HCatalogTableProvider(
        new HashMap<>(configuration),
        metastoreSchema,
        new DatabaseProvider("default", metastoreSchema, configuration));
  }

  @Override
  public String getTableType() {
    return "hcatalog";
  }

  @Override
  public void createTable(Table table) {
    throw new UnsupportedOperationException("Creating tables in HCatalog is not supported");
  }

  @Override
  public void dropTable(String tableName) {
    throw new UnsupportedOperationException("Deleting tables in HCatalog is not supported");
  }

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

  @Nullable
  @Override
  public Table getTable(String name) {
    // Tables should have been looked up from sub-providers.
    // If we reached this then getSubProvider(name) returned null
    // meaning there's no such DB. Try to look up the table in the default DB instead.

View on GitHub (pinned to 12126d8942)