{"record":{"id":"391d34bc33001a59","repo":"apache/beam","slug":"creating-tables-in-hcatalog-is-not-supported","errorCode":null,"errorMessage":"Creating tables in HCatalog is not supported","messagePattern":"Creating tables in 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":69,"sourceCode":"    this.metastoreSchema = metastoreSchema;\n  }\n\n  public static HCatalogTableProvider create(Map<String, String> configuration) {\n    HCatalogBeamSchema metastoreSchema = HCatalogBeamSchema.create(configuration);\n    return new HCatalogTableProvider(\n        new HashMap<>(configuration),\n        metastoreSchema,\n        new DatabaseProvider(\"default\", metastoreSchema, configuration));\n  }\n\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.","sourceCodeStart":51,"sourceCodeEnd":87,"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#L51-L87","documentation":"The HCatalogTableProvider (top-level catalog for hcatalog table type) rejects DDL: createTable throws UnsupportedOperationException because tables must be defined in the Hive metastore, not via Beam SQL.","triggerScenarios":"Calling createTable(Table) on HCatalogTableProvider, e.g. when a CREATE TABLE statement targets an hcatalog catalog.","commonSituations":"Same as 1232 but at the top-level provider: DDL scripts ported from other providers; framework code that generically calls createTable on any TableProvider.","solutions":["Create tables in Hive/HCatalog before referencing them in Beam SQL.","Guard framework code so it doesn't call createTable on read-only providers.","Use a provider type that supports DDL for table creation workflows."],"exampleFix":"// before\nprovider.createTable(tblSpec);\n// after\n// issue HiveQL DDL via Hive metastore client first, then query from Beam","handlingStrategy":"validation","validationCode":"if (provider instanceof HCatalogTableProvider && creatingTables) {\n  throw new IllegalArgumentException(\"Create tables in Hive metastore first\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  provider.createTable(table);\n} catch (UnsupportedOperationException e) {\n  // run DDL via Hive/metastore client instead\n}","preventionTips":["Pre-provision hcatalog tables with Hive DDL.","Check getTableType() before invoking generic DDL paths.","Keep Beam SQL queries free of CREATE TABLE for hcatalog."],"tags":["java","beam-sql","hcatalog","ddl"],"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"}