Skip to content

Generated Columns

Generated Columns are generation expressions that can produce column values at write time (unless provided by a query).

Generated Columns can be defined using the following high-level operator:

SQL Not Supported

SQL support is not available yet and tracked as #1100.

Generated Columns are stored in the table metadata.

A column is a generated column only if the Minimum Writer Version is at least 4 and the column metadata contains generation expressions.

Generated Columns is a new feature in Delta Lake 1.0.0.

Generation Expression

Generation Expression is a SQL expression to generate values.

Generation Expression is attached to a column using delta.generationExpression metadata key.

Protocol

Generated columns require the Minimum Writer Version (of a delta table) to be at least 4.

delta.generationExpression

Generated Columns feature uses the delta.generationExpression key in the Metadata of a StructField (Spark SQL) to mark a column as generated.

Demo

Generated Columns