Skip to content

Support column default values (initial-default / write-default) #730

Description

@huan233usc

Sub-issue of #637 (item 2: Column Default Values).
Iceberg v3 allows schema evolution with column default values (spec — Default values (https://iceberg.apache.org/spec/#default-values)):

  • initial-default: returned for rows that predate the column's addition, i.e. applied on the read path when a data file does not contain the field.
  • write-default: applied on the write path when a writer does not supply a value or the column.

Planned scope:

  • Schema model: carry initial-default / write-default on SchemaField
  • JSON serde: parse/write the two fields using single-value serialization
  • Read path: project missing columns as the initial-default constant instead of null when reading data files written before the column existed
  • Write path: apply write-default where values are omitted; validation (e.g. adding a required column requires an initial-default, v3+ gating)
    I plan to work on this and will send PR(s) referencing this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions