Skip to content

Add update_column_doc to UpdateSchemaAction (changing a column doc shouldn't reassign its field ID) #2742

Closed

Description

@viirya

Is your feature request related to a problem or challenge?

UpdateSchemaAction currently only supports add_column and delete_column. There is no way to change just the documentation string (doc) of an existing column.

To change a column's doc today, the only option is to delete and re-add the column. That assigns a fresh field ID to the "new" column (add_column always allocates a new id from last_column_id). Since Iceberg identifies columns by field ID, changing the id breaks reads of older data files written under the old id (the column projects as all-NULL) and severs the column's schema-evolution history. So a harmless "edit the comment" operation silently corrupts data.

Describe the solution you'd like

Add UpdateSchemaAction::update_column_doc, mirroring iceberg-java's UpdateSchema.updateColumnDoc(String name, String newDoc), which updates only the doc and preserves the field ID and every other attribute.

tx.update_schema()
    .update_column_doc("z", Some("the z column".to_string()))   // set/replace
    .update_column_doc("person.name", Some("full name".to_string())) // nested via dotted path
    .update_column_doc("legacy", None);                          // clear the doc
  • Some(doc) sets/replaces the doc; None clears it. This is the Option<String> equivalent of Java's String + null argument.
  • Nested fields are addressed by dotted path (e.g. "address.city"), consistent with delete_column.
  • The column must exist in the current schema at commit time, otherwise the commit fails with DataInvalid/PreconditionFailed.

Willingness to contribute

I can contribute this independently.

Activity

  1. TwinklerG commented on Jul 3, 2026

    @TwinklerG
    Contributor

    The feature has already been implemented in #2451.

  2. viirya commented on Jul 3, 2026

    @viirya
    MemberAuthor

    Thanks for the pointer @TwinklerG — confirmed, #2451 covers this (UpdateColumn::new_doc, applied via UpdateColumnOperation::Doc in schema_update, with a dedicated update_doc_preserves_other_metadata test). It's part of a much larger UpdateSchemaAction refactor there (required/optional toggle, type promotion, doc, default value, column move), so it supersedes this narrower PR rather than just overlapping it.

    Closing #2743 in favor of #2451.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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