{"record":{"id":"932b7339448532f4","repo":"apache/iceberg","slug":"creating-table-with-computed-columns-is-not-suppor-932b73","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":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/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/v2.2/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java#L615-L651","documentation":"FlinkCatalog.validateFlinkTable rejects any Flink table schema containing non-physical columns, such as computed (metadata/virtual/generated) columns, because Iceberg tables cannot represent them yet. It iterates schema.getColumns() and throws UnsupportedOperationException when FlinkCompatibilityUtil.isPhysicalColumn(column) is false.","triggerScenarios":"CREATE TABLE with a computed column (e.g. `proc AS PROCTIME()` or `ts AS ... GENERATED ALWAYS AS`), or CREATE TABLE LIKE / CTAS that inherits one, routed through createIcebergTable or alterTable in FlinkCatalog.","commonSituations":"Defining a proctime attribute column in a Flink SQL DDL for an Iceberg sink; porting Hive/Kafka DDL with computed columns to Iceberg.","solutions":["Remove computed columns from the DDL and compute them in the query (e.g. with a projection: `SELECT ..., PROCTIME() AS proc FROM iceberg_table`).","Define the computed column in a Flink VIEW on top of the Iceberg table instead of in the table schema.","Only declare physical columns in the Iceberg CREATE TABLE statement."],"exampleFix":"// before\nCREATE TABLE t (id BIGINT, proc AS PROCTIME()) WITH ('connector'='iceberg');\n\n// after\nCREATE TABLE t (id BIGINT) WITH ('connector'='iceberg');\nCREATE VIEW v AS SELECT id, PROCTIME() AS proc FROM t;","handlingStrategy":"validation","validationCode":"// reject computed columns before CREATE TABLE\nboolean hasComputed = ddlSchema.getColumns().stream()\n    .anyMatch(c -> c.getKind() != ColumnKind.PHYSICAL);\nif (hasComputed) {\n  // move computed columns into a view or the query\n}","typeGuard":null,"tryCatchPattern":"try {\n  catalog.createTable(tablePath, table, false);\n} catch (UnsupportedOperationException e) {\n  // strip non-physical columns and retry, or create a view\n}","preventionTips":["Keep Iceberg DDL to physical columns only","Put PROCTIME()/derived columns in Flink views","Check DDL templates for generated-column syntax before applying"],"tags":["flink","ddl","computed-columns"],"backgroundTag":"unsupported-operation","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"}