UpdateSchema
struct UpdateSchemaSchema changes, recorded now and applied at commit time.
Implements Copyable, Defaultable, Movable
- Fields
ops: List[_SchemaOp]
__init__
def __init__(out self) is_empty
def is_empty(self) -> Bool add_column
def add_column(mut self, name: String, type: String, doc: String = "") Add an optional top-level column.
type is the Iceberg JSON type: a primitive's spelling (long,
decimal(10, 2), quoted or not) or a struct/list/map object.
Field ids inside a nested type are placeholders; they are replaced by
fresh ones.
add_nested_column
def add_nested_column(mut self, parent: String, name: String, type: String, doc: String = "") Add an optional field to the struct at parent (addr, a.b).
A parent that is a list adds to its element struct, and a map to its
value struct, the way Java resolves a parent.
rename_column
def rename_column(mut self, path: String, new_name: String) Rename a field. Its id, and so every data file, is unaffected.
make_column_optional
def make_column_optional(mut self, path: String) Let a required field (or a list element, or a map value) be null.
update_column_type
def update_column_type(mut self, path: String, new_type: String) Widen a primitive the way the spec allows: int→long, float→double, decimal(P, S)→decimal(P', S) with P' > P.
union_by_name
def union_by_name(mut self, schema: Schema) Make the table's schema hold every field of schema, matched by name: a missing field is added (it must be optional), a field schema marks optional becomes optional, a changed doc is taken, and fields schema does not mention are kept. Structs are merged at any depth, including a list's element and a map's value. A field whose type differs raises: no promotion, no replacement.
schema's own field ids are ignored — only names count.
apply
def apply(self, base: Schema, last_column_id: Int) -> Tuple[Schema, Int] The changes applied to base: the new schema (still carrying base's id) and the new last-column-id.