{"record":{"id":"302b5fdcf1e4c2f8","repo":"apache/beam","slug":"deleting-tables-is-not-supported-in-hcatalog","errorCode":null,"errorMessage":"Deleting tables is not supported in HCatalog","messagePattern":"Deleting 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":62,"sourceCode":"  }\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;\n    }\n\n    return Table.builder()\n        .schema(tableSchema.get())\n        .name(table)","sourceCodeStart":44,"sourceCodeEnd":80,"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#L44-L80","documentation":"DatabaseProvider.dropTable unconditionally throws UnsupportedOperationException: the HCatalog-backed table provider is read/write for data but implements no DDL against the metastore, so table deletion is a declared unsupported operation. The input at fault is simply the dropTable call itself (e.g. from a DROP TABLE SQL statement).","triggerScenarios":"Invoking dropTable(tableName) on the hcatalog DatabaseProvider (e.g. via DROP TABLE DDL routed through Beam SQL).","commonSituations":"Cleanup pipelines trying to DROP TABLE via Beam SQL; test teardown code reusing provider dropTable for hcatalog-backed catalogs.","solutions":["Drop the table using Hive DDL or the HCatalog client API outside Beam.","Refactor code to not call dropTable on hcatalog providers.","Catch UnsupportedOperationException if the drop is best-effort."],"exampleFix":"// before\nprovider.dropTable(\"tbl\");\n// after\nHCatClient client = HCatUtil.getHcatClient(hiveConf);\nclient.dropTable(dbName, \"tbl\", true, false);","handlingStrategy":"try-catch","validationCode":"boolean canDrop = !\"hcatalog\".equals(provider.getTableType());","typeGuard":null,"tryCatchPattern":"try {\n  provider.dropTable(name);\n} catch (UnsupportedOperationException e) {\n  hcatClient.dropTable(db, name, true, false); // external lifecycle management\n}","preventionTips":["Never route DROP TABLE through Beam SQL for hcatalog catalogs.","Use HCatalog/Hive client APIs for table lifecycle.","Make teardown helpers provider-aware."],"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"}