{"record":{"id":"2a77eeae83fded3b","repo":"apache/iceberg","slug":"creating-table-with-computed-columns-is-not-suppor","errorCode":null,"errorMessage":"Creating table with computed columns is not supported yet.","messagePattern":"Creating table with computed columns is not supported yet\\.","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java","lineNumber":633,"sourceCode":"        icebergTable,\n        setLocation,\n        setSnapshotId,\n        cherrypickSnapshotId,\n        schemaChanges,\n        propertyChanges);\n  }\n\n  private static void validateFlinkTable(CatalogBaseTable table) {\n    Preconditions.checkArgument(\n        table instanceof CatalogTable, \"The Table should be a CatalogTable.\");\n\n    org.apache.flink.table.api.Schema schema = table.getUnresolvedSchema();\n    schema\n        .getColumns()\n        .forEach(\n            column -> {\n              if (!FlinkCompatibilityUtil.isPhysicalColumn(column)) {\n                throw new UnsupportedOperationException(\n                    \"Creating table with computed columns is not supported yet.\");\n              }\n            });\n\n    if (!schema.getWatermarkSpecs().isEmpty()) {\n      throw new UnsupportedOperationException(\n          \"Creating table with watermark specs is not supported yet.\");\n    }\n  }\n\n  private static PartitionSpec toPartitionSpec(List<String> partitionKeys, Schema icebergSchema) {\n    PartitionSpec.Builder builder = PartitionSpec.builderFor(icebergSchema);\n    partitionKeys.forEach(builder::identity);\n    return builder.build();\n  }\n\n  private static List<String> toPartitionKeys(PartitionSpec spec, Schema icebergSchema) {\n    ImmutableList.Builder<String> partitionKeysBuilder = ImmutableList.builder();","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java#L615-L651","documentation":"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.","triggerScenarios":"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.","commonSituations":"Defining a processing-time/proctime column in Iceberg DDL; reusing a Flink connector DDL snippet containing computed columns; frameworks generating schemas with derived columns.","solutions":["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).","Create a Flink VIEW on top of the Iceberg table that adds the computed columns.","Use Iceberg metadata columns or a generated column feature only if/when supported by the Iceberg spec — currently physical columns only."],"exampleFix":"// before\nCREATE TABLE t (id INT, event_time AS CURRENT_TIMESTAMP) WITH (...);\n// after\nCREATE TABLE t (id INT, event_time TIMESTAMP(3));\nCREATE VIEW v AS SELECT id, CURRENT_TIMESTAMP AS event_time FROM t;","handlingStrategy":"validation","validationCode":"boolean hasComputed = table.getUnresolvedSchema().getColumns().stream()\n    .anyMatch(c -> !(c instanceof org.apache.flink.table.catalog.Column.PhysicalColumn));\nif (hasComputed) { throw new IllegalArgumentException(\"Remove computed columns before creating Iceberg table\"); }","typeGuard":"boolean allPhysicalColumns(org.apache.flink.table.api.Schema s) {\n  return s.getColumns().stream()\n    .allMatch(c -> c instanceof org.apache.flink.table.catalog.Column.PhysicalColumn);\n}","tryCatchPattern":"try { catalog.createTable(path, table); }\ncatch (UnsupportedOperationException e) { /* move computed columns into a view */ }","preventionTips":["Only declare physical columns in Iceberg DDL","Express derived values in views or query expressions","Review generated DDL templates for computed/metadata column syntax"],"tags":["flink","schema-validation","computed-columns","unsupported-operation"],"backgroundTag":"schema-validation-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}