apache/iceberg · error · UnsupportedOperationException
Cannot apply unknown modify-column-position change:
Error message
Cannot apply unknown modify-column-position change:
What it means
applyModifyColumnPosition supports only TableChange.First and TableChange.After positions; any other ModifyColumnPosition subtype throws UnsupportedOperationException. It maps Flink column-position changes onto Iceberg moveFirst/moveAfter operations.
Source
Thrown at flink/v2.3/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
- Express the position as TableChange.First or TableChange.After.
- Rewrite the DDL to use AFTER with the preceding column name instead of BEFORE.
- Apply the move directly: updateSchema().moveBefore(...) on the Table API if BEFORE semantics are needed.
Example fix
// before
new TableChange.ModifyColumnPosition(new TableChange.Before("other"), column);
// after
new TableChange.ModifyColumnPosition(new TableChange.After("other"), column); Defensive patterns
Strategy: validation
Validate before calling
// java
if (!(pos instanceof TableChange.First) && !(pos instanceof TableChange.After)) {
throw new IllegalArgumentException("only First/After positions supported; rewrite BEFORE as AFTER");
} Type guard
boolean isSupportedPosition(TableChange.ColumnPosition pos) {
return pos instanceof TableChange.First || pos instanceof TableChange.After;
} Try / catch
try {
FlinkAlterTableUtil.applyModifyColumnPosition(update, change);
} catch (UnsupportedOperationException e) {
if (e.getMessage().startsWith("Cannot apply unknown modify-column-position")) {
// convert Before to After with preceding column and retry
} else { throw e; }
} Prevention
- Rewrite BEFORE-clause position DDL as AFTER with the preceding column.
- Use updateSchema().moveBefore/moveAfter directly for BEFORE semantics.
- Cover position changes with a unit test against this utility.
When it happens
Trigger: Issuing a column-position change using TableChange.Before (or another position subtype) through the Flink alter-table path.
Common situations: Using `ALTER TABLE ... MODIFY COLUMN c AFTER/BY ...` DDL variants that Flink translates to a position subtype Iceberg does not handle.
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
- Cannot apply unknown modify-column-position change:
- Altering schema is not supported in the old alterTable API.
- Altering partition keys is not supported yet.
- Creating table with computed columns is not supported yet.
- Creating table with watermark specs is not supported yet.
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/b73722dcbe04f0f2.
Report an issue: GitHub.