apache/beam · error · UnsupportedOperationException

Deleting tables is not supported in HCatalog

Error message

Deleting tables is not supported in HCatalog

What it means

DatabaseProvider.dropTable unconditionally throws UnsupportedOperationException: the HCatalog-backed table provider is read/write for data but implements no DDL against the metastore, so table deletion is a declared unsupported operation. The input at fault is simply the dropTable call itself (e.g. from a DROP TABLE SQL statement).

Solutions

  1. Drop the table using Hive DDL or the HCatalog client API outside Beam.
  2. Refactor code to not call dropTable on hcatalog providers.
  3. Catch UnsupportedOperationException if the drop is best-effort.

Example fix

// before
provider.dropTable("tbl");
// after
HCatClient client = HCatUtil.getHcatClient(hiveConf);
client.dropTable(dbName, "tbl", true, false);
Defensive patterns

Strategy: try-catch

Validate before calling

boolean canDrop = !"hcatalog".equals(provider.getTableType());

Try / catch

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

Prevention

When it happens

Trigger: Invoking dropTable(tableName) on the hcatalog DatabaseProvider (e.g. via DROP TABLE DDL routed through Beam SQL).

Common situations: Cleanup pipelines trying to DROP TABLE via Beam SQL; test teardown code reusing provider dropTable for hcatalog-backed catalogs.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/302b5fdcf1e4c2f8. 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/DatabaseProvider.java:62

  }

  String getDb() {
    return db;
  }

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

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

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

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

  /** Table metadata to pass the schema to Calcite. */
  @Override
  public @Nullable Table getTable(String table) {
    Optional<Schema> tableSchema = metastoreSchema.getTableSchema(db, table);
    if (!tableSchema.isPresent()) {
      return null;
    }

    return Table.builder()
        .schema(tableSchema.get())
        .name(table)

View on GitHub (pinned to 12126d8942)