{"record":{"id":"0f41c0a7c991ecfb","repo":"apache/beam","slug":"alter-is-not-supported-for-table-s-of-type-s","errorCode":null,"errorMessage":"ALTER is not supported for table '%s' of type '%s'.","messagePattern":"ALTER is not supported for table '(.+?)' of type '(.+?)'\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/TableProvider.java","lineNumber":85,"sourceCode":"   */\n  default Set<String> getSubProviders() {\n    return Collections.emptySet();\n  }\n\n  /**\n   * Returns a sub-provider, e.g. sub-schema. Temporary, this logic needs to live in {@link\n   * BeamCalciteSchema}.\n   */\n  default @Nullable TableProvider getSubProvider(String name) {\n    return null;\n  }\n\n  default boolean supportsPartitioning(Table table) {\n    return false;\n  }\n\n  default AlterTableOps alterTable(String name) {\n    throw new UnsupportedOperationException(\n        String.format(\"ALTER is not supported for table '%s' of type '%s'.\", name, getTableType()));\n  }\n}\n","sourceCodeStart":67,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/TableProvider.java#L67-L89","documentation":"The default alterTable method in Beam SQL's TableProvider interface throws UnsupportedOperationException because most table providers do not implement ALTER operations. Providers must override alterTable to support ALTER TABLE; the default implementation reports the table name and provider type so the developer knows which provider lacks the capability.","triggerScenarios":"Executing an ALTER TABLE statement through Beam SQL against a TableProvider that does not override alterTable(name) — the framework calls provider.alterTable(tableName), hits the default interface method, and throws with the table name and getTableType().","commonSituations":"Running DDL like ALTER TABLE ADD/DROP COLUMN against in-memory or file-backed providers (e.g. the default providers in tests, CSV/JSON/text providers) that only support CREATE/SELECT; migrating SQL scripts written for a database to Beam SQL.","solutions":["Avoid ALTER TABLE for this provider; drop and recreate the table with the desired schema","Choose a table provider that overrides alterTable and supports the operation","Implement alterTable in a custom TableProvider subclass to handle the required AlterTableOps"],"exampleFix":"// before\nALTER TABLE mytable ADD COLUMN c1 INTEGER;\n// after\neval(\"DROP TABLE mytable\");\neval(\"CREATE TABLE mytable (...) WITH ...\");","handlingStrategy":"try-catch","validationCode":"// before running ALTER\nTableProvider provider = ...; // resolve provider by table type\nif (provider.alterTable(name) is default Unsupported -> check docs) { /* only providers overriding alterTable support DDL */ }","typeGuard":null,"tryCatchPattern":"try {\n  provider.alterTable(tableName);\n} catch (UnsupportedOperationException e) {\n  throw new SqlFeatureNotSupportedException(\"Provider \" + provider.getTableType() + \" does not support ALTER\");\n}","preventionTips":["Consult the provider's docs for DDL support before writing ALTER statements","Model schema changes as drop/recreate in portable pipeline code","Keep DDL scripts provider-specific instead of assuming SQL-engine parity"],"tags":["beam-sql","ddl","unsupported-operation"],"backgroundTag":"method-not-implemented","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"}