apache/iceberg · error · java.lang.UnsupportedOperationException

Creating table with computed columns is not supported yet.

Error message

Creating table with computed columns is not supported yet.

What it means

FlinkCatalog.validateFlinkTable rejects any Flink Schema containing computed (non-physical) columns, since Iceberg tables store only physical columns and there is no translation for metadata/computed column expressions. It iterates the unresolved schema columns and throws UnsupportedOperationException if FlinkCompatibilityUtil.isPhysicalColumn is false.

Source

Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:633

        icebergTable,
        setLocation,
        setSnapshotId,
        cherrypickSnapshotId,
        schemaChanges,
        propertyChanges);
  }

  private static void validateFlinkTable(CatalogBaseTable table) {
    Preconditions.checkArgument(
        table instanceof CatalogTable, "The Table should be a CatalogTable.");

    org.apache.flink.table.api.Schema schema = table.getUnresolvedSchema();
    schema
        .getColumns()
        .forEach(
            column -> {
              if (!FlinkCompatibilityUtil.isPhysicalColumn(column)) {
                throw new UnsupportedOperationException(
                    "Creating table with computed columns is not supported yet.");
              }
            });

    if (!schema.getWatermarkSpecs().isEmpty()) {
      throw new UnsupportedOperationException(
          "Creating table with watermark specs is not supported yet.");
    }
  }

  private static PartitionSpec toPartitionSpec(List<String> partitionKeys, Schema icebergSchema) {
    PartitionSpec.Builder builder = PartitionSpec.builderFor(icebergSchema);
    partitionKeys.forEach(builder::identity);
    return builder.build();
  }

  private static List<String> toPartitionKeys(PartitionSpec spec, Schema icebergSchema) {
    ImmutableList.Builder<String> partitionKeysBuilder = ImmutableList.builder();

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Remove computed columns from the Iceberg table DDL and define them in the query/job layer (e.g. in a Flink view or SELECT expression).
  2. Create a Flink VIEW on top of the Iceberg table that adds the computed columns.
  3. Use Iceberg metadata columns or a generated column feature only if/when supported by the Iceberg spec — currently physical columns only.

Example fix

// before
CREATE TABLE t (id INT, event_time AS CURRENT_TIMESTAMP) WITH (...);
// after
CREATE TABLE t (id INT, event_time TIMESTAMP(3));
CREATE VIEW v AS SELECT id, CURRENT_TIMESTAMP AS event_time FROM t;
Defensive patterns

Strategy: validation

Validate before calling

boolean hasComputed = table.getUnresolvedSchema().getColumns().stream()
    .anyMatch(c -> !(c instanceof org.apache.flink.table.catalog.Column.PhysicalColumn));
if (hasComputed) { throw new IllegalArgumentException("Remove computed columns before creating Iceberg table"); }

Type guard

boolean allPhysicalColumns(org.apache.flink.table.api.Schema s) {
  return s.getColumns().stream()
    .allMatch(c -> c instanceof org.apache.flink.table.catalog.Column.PhysicalColumn);
}

Try / catch

try { catalog.createTable(path, table); }
catch (UnsupportedOperationException e) { /* move computed columns into a view */ }

Prevention

When it happens

Trigger: CREATE TABLE with a column defined by an expression (Flink computed column, e.g. `ts AS PROCTIME()` or `d AS f(ts)`) passed through createIcebergTable or alterTable in an Iceberg catalog.

Common situations: Defining a processing-time/proctime column in Iceberg DDL; reusing a Flink connector DDL snippet containing computed columns; frameworks generating schemas with derived columns.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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