apache/beam · error · UnsupportedOperationException
ALTER is not supported for table
Error message
ALTER is not supported for table '%s' of type '%s'.
What it means
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.
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
Example fix
// before
ALTER TABLE mytable ADD COLUMN c1 INTEGER;
// after
eval("DROP TABLE mytable");
eval("CREATE TABLE mytable (...) WITH ..."); Defensive patterns
Strategy: try-catch
Validate before calling
// before running ALTER
TableProvider provider = ...; // resolve provider by table type
if (provider.alterTable(name) is default Unsupported -> check docs) { /* only providers overriding alterTable support DDL */ } Try / catch
try {
provider.alterTable(tableName);
} catch (UnsupportedOperationException e) {
throw new SqlFeatureNotSupportedException("Provider " + provider.getTableType() + " does not support ALTER");
} Prevention
- 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
When it happens
Trigger: 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().
Common situations: 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.
Related errors
- Cannot drop catalog: ' ' not found.
- Cannot use catalog: ' ' not found.
- Catalog ' ' already exists.
- Conversion from to BigDecimal is not supported
- 'CREATE TABLE' is not supported in SQL. You can use 'CREATE…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/0f41c0a7c991ecfb.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/TableProvider.java:85
*/
default Set<String> getSubProviders() {
return Collections.emptySet();
}
/**
* Returns a sub-provider, e.g. sub-schema. Temporary, this logic needs to live in {@link
* BeamCalciteSchema}.
*/
default @Nullable TableProvider getSubProvider(String name) {
return null;
}
default boolean supportsPartitioning(Table table) {
return false;
}
default AlterTableOps alterTable(String name) {
throw new UnsupportedOperationException(
String.format("ALTER is not supported for table '%s' of type '%s'.", name, getTableType()));
}
}
View on GitHub (pinned to 12126d8942)