apache/beam · error · UnsupportedOperationException

Extracting all tables from HCatalog is not supported

Error message

Extracting all tables from HCatalog is not supported

What it means

HCatalogTableProvider.getTables() is an intentionally unsupported bulk-enumeration operation: the hcatalog table provider can serve individual tables via getTable() but cannot enumerate the entire Hive metastore catalog, so any SQL operation that requires listing all tables (e.g. SHOW TABLES or catalog-wide metadata queries) against an hcatalog provider hits this guard and fails immediately.

Solutions

  1. Query the Hive metastore directly (e.g. HCatClient.getAllTables) for listings.
  2. Reference tables by explicit name and use getTable(name) instead.
  3. Avoid APIs that iterate provider.getTables() when hcatalog providers are registered.

Example fix

// before
Map<String, Table> all = provider.getTables();
// after
Table t = provider.getTable("db.tbl");
// listing: HCatClient h = HCatUtil.getHcatClient(conf); h.getAllTables("db");
Defensive patterns

Strategy: validation

Validate before calling

if (provider instanceof HCatalogTableProvider && needsEnumeration) {
  // use HCatClient.getAllTables(db) instead of provider.getTables()
}

Try / catch

try {
  all = provider.getTables();
} catch (UnsupportedOperationException e) {
  all = metastoreListTables(db); // HCatClient-based fallback
}

Prevention

When it happens

Trigger: Calling getTables() on HCatalogTableProvider, e.g. during wildcard table resolution or catalog-wide metadata listing.

Common situations: Schema browsers or planners enumerating tables; code assuming TableProvider.getTables() is always available.

Related errors


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

  @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) {
    // This is the same `default` DB use case similar to how `getTable()` behaves.
    // This path should only be hit if none of the sub-providers for the DBs
    // was able to find the table.
    return defaultDBProvider.buildBeamSqlTable(table);
  }

View on GitHub (pinned to 12126d8942)