{"record":{"id":"ab48e522a810f5d6","repo":"apache/beam","slug":"listing-tables-is-not-supported-in-hcatalog","errorCode":null,"errorMessage":"Listing tables is not supported in HCatalog","messagePattern":"Listing tables is not supported in HCatalog","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/hcatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/hcatalog/DatabaseProvider.java","lineNumber":67,"sourceCode":"\n  @Override\n  public String getTableType() {\n    return \"hcatalog\";\n  }\n\n  @Override\n  public void createTable(Table table) {\n    throw new UnsupportedOperationException(\"Creating tables is not supported in HCatalog\");\n  }\n\n  @Override\n  public void dropTable(String tableName) {\n    throw new UnsupportedOperationException(\"Deleting tables is not supported in HCatalog\");\n  }\n\n  @Override\n  public Map<String, Table> getTables() {\n    throw new UnsupportedOperationException(\"Listing tables is not supported in HCatalog\");\n  }\n\n  /** Table metadata to pass the schema to Calcite. */\n  @Override\n  public @Nullable Table getTable(String table) {\n    Optional<Schema> tableSchema = metastoreSchema.getTableSchema(db, table);\n    if (!tableSchema.isPresent()) {\n      return null;\n    }\n\n    return Table.builder()\n        .schema(tableSchema.get())\n        .name(table)\n        .location(\"\")\n        .comment(\"\")\n        .type(\"hcatalog\")\n        .build();\n  }","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/hcatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/hcatalog/DatabaseProvider.java#L49-L85","documentation":"The HCatalog DatabaseProvider cannot enumerate tables of a database; it resolves individual tables lazily via getTable using metastore schema lookups. getTables() throws UnsupportedOperationException.","triggerScenarios":"Calling getTables() on the hcatalog DatabaseProvider (e.g. catalog-wide table enumeration or Calcite schema mapping that lists tables).","commonSituations":"Tools listing all available tables for autocomplete/plan validation; 'SHOW TABLES'-style operations through Beam SQL against hcatalog.","solutions":["List tables via the Hive metastore/Hive client instead of the Beam provider.","Look up known tables individually with getTable(name).","Avoid code paths that require full table enumeration for hcatalog catalogs."],"exampleFix":"// before\nMap<String, Table> tables = provider.getTables();\n// after\nTable t = provider.getTable(\"tbl\"); // per-table lookup works\n// or enumerate via Hive metastore client","handlingStrategy":"validation","validationCode":"if (\"hcatalog\".equals(provider.getTableType())) {\n  // avoid getTables(); look up per-table via getTable(name)\n}","typeGuard":null,"tryCatchPattern":"try {\n  tables = provider.getTables();\n} catch (UnsupportedOperationException e) {\n  tables = listTablesViaMetastore(dbName); // HCatClient.getAllTables\n}","preventionTips":["Avoid catalog-wide enumeration on hcatalog providers.","Use explicit table names in queries.","Fetch listings with a Hive metastore client when needed."],"tags":["java","beam-sql","hcatalog","metadata"],"backgroundTag":"operation-not-supported","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}