{"record":{"id":"fb013422f20d985f","repo":"apache/beam","slug":"creating-tables-is-not-supported-in-hcatalog","errorCode":null,"errorMessage":"Creating tables is not supported in HCatalog","messagePattern":"Creating 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":57,"sourceCode":"\n  DatabaseProvider(String db, HCatalogBeamSchema metastoreSchema, Map<String, String> config) {\n    this.db = db;\n    this.metastoreSchema = metastoreSchema;\n    this.config = config;\n  }\n\n  String getDb() {\n    return db;\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 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;","sourceCodeStart":39,"sourceCodeEnd":75,"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#L39-L75","documentation":"The HCatalog DatabaseProvider is read-only: schema/tables in a Hive metastore are managed by Hive itself, not Beam SQL. Any attempt to create a table through this provider throws UnsupportedOperationException.","triggerScenarios":"Invoking createTable(Table) on the hcatalog table provider (e.g. via a 'CREATE TABLE' statement or TableProvider.createTable API).","commonSituations":"Running DDL like CREATE TABLE against an hcatalog catalog in Beam SQL; porting pipelines written for other providers (e.g. in-memory, text) to HCatalog.","solutions":["Create the table in Hive/HCatalog first (Hive DDL), then query it from Beam SQL.","Use a different table provider that supports DDL (e.g. in-memory, iceberg if applicable).","Remove CREATE TABLE statements from the Beam SQL query and treat metastore tables as pre-existing."],"exampleFix":"// before\nCREATE TABLE hcatalog.db.tbl (id INT) AS SELECT 1;\n// after\n// run DDL in Hive first, then in Beam SQL:\nSELECT * FROM hcatalog.db.tbl;","handlingStrategy":"validation","validationCode":"if (\"hcatalog\".equals(provider.getTableType()) && needsDdl) {\n  throw new IllegalArgumentException(\"Issue Hive DDL externally; hcatalog provider is read-only\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  provider.createTable(table);\n} catch (UnsupportedOperationException e) {\n  // fall back to Hive metastore client DDL\n}","preventionTips":["Treat hcatalog tables as pre-existing: create them in Hive first.","Gate DDL code on provider capabilities, not on TableProvider interface alone.","Document read-only provider limitations in pipeline design docs."],"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"}