apache/beam · error · UnsupportedOperationException

Deleting tables in HCatalog is not supported

Error message

Deleting tables in HCatalog is not supported

What it means

HCatalogTableProvider.dropTable unconditionally throws to signal that this provider performs no metastore DDL: creating and deleting tables through the Beam SQL HCatalog provider is not implemented. The dropTable invocation itself is the rejected operation; manage Hive tables directly via the metastore instead.

Solutions

  1. Drop tables via Hive DDL or HCatClient outside Beam.
  2. Wrap best-effort drops in try-catch for UnsupportedOperationException.
  3. Skip dropTable calls when provider.getTableType().equals("hcatalog").

Example fix

// before
provider.dropTable("tbl");
// after
if (!"hcatalog".equals(provider.getTableType())) {
  provider.dropTable("tbl");
} else {
  hcatClient.dropTable(db, "tbl", true, false);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (provider instanceof HCatalogTableProvider && droppingTables) {
  throw new IllegalArgumentException("Drop tables via Hive client, not Beam SQL");
}

Try / catch

try {
  provider.dropTable(name);
} catch (UnsupportedOperationException e) {
  hcatClient.dropTable(db, name, true, false);
}

Prevention

When it happens

Trigger: Calling dropTable(tableName) on HCatalogTableProvider (e.g. DROP TABLE DDL or generic provider teardown).

Common situations: Cleanup/teardown utilities calling dropTable generically across providers; DROP TABLE statements in Beam SQL against hcatalog.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/389f03b308046c84. 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:74

    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.
    return defaultDBProvider.getTable(name);
  }

  @Override
  public BeamSqlTable buildBeamSqlTable(Table table) {

View on GitHub (pinned to 12126d8942)