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 position changes; any other TableChange position subclass (or null-like unknown variant) throws this UnsupportedOperationException. It signals that column-reposition logic received an unrecognized position marker.

Source

Thrown at flink/v2.2/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

  1. Map Before positions manually to After (previous column) or First before submitting the change
  2. Upgrade iceberg-flink to a version handling the emitted position variant
  3. Catch the exception and fall back to explicit UpdateSchema.moveFirst/moveAfter calls

Example fix

// before
change = TableChange.modifyColumnPosition(col, someBeforePosition);
// after
change = TableChange.after(col, previousColumnName); // or table.changeSchema().moveFirst(col)
Defensive patterns

Strategy: type-guard

Validate before calling

static boolean hasSupportedPosition(TableChange.ModifyColumnPosition c) {
  return c.newPosition() instanceof TableChange.First || c.newPosition() instanceof TableChange.After;
}
if (!hasSupportedPosition(c)) throw new IllegalArgumentException("Only First/After positions supported");

Type guard

static boolean isSupportedPosition(TableChange c) {
  return c instanceof TableChange.First || c instanceof TableChange.After;
}

Try / catch

try { FlinkAlterTableUtil.applySchemaChanges(update, changes); }
catch (UnsupportedOperationException e) {
  if (e.getMessage().startsWith("Cannot apply unknown modify-column-position")) { /* convert to After/First */ }
  throw e;
}

Prevention

When it happens

Trigger: A TableChange.ModifyColumnPosition whose newPosition is neither First nor After (e.g. Before semantics arriving as an unhandled variant) passed through applySchemaChanges.

Common situations: Flink emits a new position change kind not supported by the Iceberg runtime version; custom code constructing ModifyColumnPosition with a custom position class.

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


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/eef5c0bd0b534f5e. Report an issue: GitHub.