apache/iceberg · error · UnsupportedOperationException
Cannot apply unknown modify-column-position change: {modifyC
Error message
Cannot apply unknown modify-column-position change: {modifyColumnPosition} What it means
applyModifyColumnPosition supports only TableChange.First and TableChange.After. Any other ModifyColumnPosition subtype (or null beyond these) throws UnsupportedOperationException, because Iceberg moves only support first/after semantics.
Source
Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/util/FlinkAlterTableUtil.java:241
(TableChange.ModifyColumnComment) modifyColumn;
pendingUpdate.updateColumnDoc(
modifyComment.getOldColumn().getName(), modifyComment.getNewComment());
} else {
throw new UnsupportedOperationException(
"Cannot apply unknown modify-column change: " + modifyColumn);
}
}
private static void applyModifyColumnPosition(
UpdateSchema pendingUpdate, TableChange.ModifyColumnPosition modifyColumnPosition) {
TableChange.ColumnPosition newPosition = modifyColumnPosition.getNewPosition();
if (newPosition instanceof TableChange.First) {
pendingUpdate.moveFirst(modifyColumnPosition.getOldColumn().getName());
} else if (newPosition instanceof TableChange.After) {
TableChange.After after = (TableChange.After) newPosition;
pendingUpdate.moveAfter(modifyColumnPosition.getOldColumn().getName(), after.column());
} else {
throw new UnsupportedOperationException(
"Cannot apply unknown modify-column-position change: " + modifyColumnPosition);
}
}
private static void applyUniqueConstraint(
UpdateSchema pendingUpdate, UniqueConstraint constraint) {
switch (constraint.getType()) {
case PRIMARY_KEY:
pendingUpdate.setIdentifierFields(constraint.getColumns());
break;
case UNIQUE_KEY:
throw new UnsupportedOperationException(
"Unsupported table change: setting unique key constraints.");
default:
throw new UnsupportedOperationException(
"Cannot apply unknown unique constraint: " + constraint.getType().name());
}
}View on GitHub (pinned to 86d9c8fc54)
Solutions
- Convert the position change to TableChange.After with the preceding column name, or First
- Implement a Before->After translation (after the previous column) before calling the util
- Drop the positional clause from the DDL for Iceberg tables
Example fix
// before TableChange.Before before = ...; applyModifyColumnPosition(update, new ModifyColumnPosition(col, before)); // after TableChange.After after = TableChange.after(previousColumnName()); applyModifyColumnPosition(update, new TableChange.ModifyColumnPosition(col, after));
Defensive patterns
Strategy: validation
Validate before calling
if (newPosition instanceof TableChange.First) {
// ok
} else if (newPosition instanceof TableChange.After a) {
if (a.column() == null) throw new IllegalArgumentException("After.column must be set");
} else {
throw new IllegalArgumentException("Unsupported column position: " + newPosition);
} Type guard
boolean isSupportedPosition(TableChange.ColumnPosition p) {
return p instanceof TableChange.First || p instanceof TableChange.After;
} Try / catch
try {
FlinkAlterTableUtil.applySchemaChanges(update, List.of(change));
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("modify-column-position")) { /* translate to After/First */ }
throw e;
} Prevention
- Translate any non-First/non-After position semantics (e.g. Before) to After with the preceding column before applying
- Restrict generated DDL to FIRST/AFTER column positions
When it happens
Trigger: Passing a TableChange.ModifyColumnPosition whose newPosition is neither First nor After (e.g. TableChange.Before-like custom subtype) through applyAddColumn/applyModifyColumn.
Common situations: Custom Flink catalog or SQL dialect emitting positional change types Iceberg cannot express.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unsupported table change: AddWatermark.
- Unsupported table change: ModifyWatermark.
- Unsupported table change: DropWatermark.
- Unsupported table change: DropConstraint.
- Cannot apply unknown table change: {change}
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/d79231bc9287a93f.
Report an issue: GitHub.