{"record":{"id":"8e15fbb43e260143","repo":"apache/beam","slug":"extracting-all-tables-from-hcatalog-is-not-supported","errorCode":null,"errorMessage":"Extracting all tables from HCatalog is not supported","messagePattern":"Extracting all tables from HCatalog is not supported","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/HCatalogTableProvider.java","lineNumber":79,"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 in HCatalog is not supported\");\n  }\n\n  @Override\n  public void dropTable(String tableName) {\n    throw new UnsupportedOperationException(\"Deleting tables in HCatalog is not supported\");\n  }\n\n  @Override\n  public Map<String, Table> getTables() {\n    throw new UnsupportedOperationException(\"Extracting all tables from HCatalog is not supported\");\n  }\n\n  @Nullable\n  @Override\n  public Table getTable(String name) {\n    // Tables should have been looked up from sub-providers.\n    // If we reached this then getSubProvider(name) returned null\n    // meaning there's no such DB. Try to look up the table in the default DB instead.\n    return defaultDBProvider.getTable(name);\n  }\n\n  @Override\n  public BeamSqlTable buildBeamSqlTable(Table table) {\n    // This is the same `default` DB use case similar to how `getTable()` behaves.\n    // This path should only be hit if none of the sub-providers for the DBs\n    // was able to find the table.\n    return defaultDBProvider.buildBeamSqlTable(table);\n  }","sourceCodeStart":61,"sourceCodeEnd":97,"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/HCatalogTableProvider.java#L61-L97","documentation":"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.","triggerScenarios":"Calling getTables() on HCatalogTableProvider, e.g. during wildcard table resolution or catalog-wide metadata listing.","commonSituations":"Schema browsers or planners enumerating tables; code assuming TableProvider.getTables() is always available.","solutions":["Query the Hive metastore directly (e.g. HCatClient.getAllTables) for listings.","Reference tables by explicit name and use getTable(name) instead.","Avoid APIs that iterate provider.getTables() when hcatalog providers are registered."],"exampleFix":"// before\nMap<String, Table> all = provider.getTables();\n// after\nTable t = provider.getTable(\"db.tbl\");\n// listing: HCatClient h = HCatUtil.getHcatClient(conf); h.getAllTables(\"db\");","handlingStrategy":"validation","validationCode":"if (provider instanceof HCatalogTableProvider && needsEnumeration) {\n  // use HCatClient.getAllTables(db) instead of provider.getTables()\n}","typeGuard":null,"tryCatchPattern":"try {\n  all = provider.getTables();\n} catch (UnsupportedOperationException e) {\n  all = metastoreListTables(db); // HCatClient-based fallback\n}","preventionTips":["Resolve tables by name; never enumerate on hcatalog providers.","Use metastore clients for discovery.","Wrap generic schema-tree builders with provider-capability checks."],"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"}