apache/beam · error · UnsupportedOperationException

Listing tables is not supported in HCatalog

Error message

Listing tables is not supported in HCatalog

What it means

The HCatalog DatabaseProvider cannot enumerate tables of a database; it resolves individual tables lazily via getTable using metastore schema lookups. getTables() throws UnsupportedOperationException.

Solutions

  1. List tables via the Hive metastore/Hive client instead of the Beam provider.
  2. Look up known tables individually with getTable(name).
  3. Avoid code paths that require full table enumeration for hcatalog catalogs.

Example fix

// before
Map<String, Table> tables = provider.getTables();
// after
Table t = provider.getTable("tbl"); // per-table lookup works
// or enumerate via Hive metastore client
Defensive patterns

Strategy: validation

Validate before calling

if ("hcatalog".equals(provider.getTableType())) {
  // avoid getTables(); look up per-table via getTable(name)
}

Try / catch

try {
  tables = provider.getTables();
} catch (UnsupportedOperationException e) {
  tables = listTablesViaMetastore(dbName); // HCatClient.getAllTables
}

Prevention

When it happens

Trigger: Calling getTables() on the hcatalog DatabaseProvider (e.g. catalog-wide table enumeration or Calcite schema mapping that lists tables).

Common situations: Tools listing all available tables for autocomplete/plan validation; 'SHOW TABLES'-style operations through Beam SQL against hcatalog.

Related errors


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

  @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)
        .location("")
        .comment("")
        .type("hcatalog")
        .build();
  }

View on GitHub (pinned to 12126d8942)