AccessorField
struct AccessorField
A field reachable by name: its id, full dotted name and type index.
Implements Copyable, Movable
- Fields
id: Intname: Stringtype: Intrequired: Boolparent: Int: Position in Schema.flat of the field this one is nested in, or -1.child_pos: Int: Position among the parent struct's fields, or -1 for a list element and a map key or value — the places a dotted path cannot walk through.
simple
def simple(id: Int, var name: String, type: Int, required: Bool) -> Self
Schema
struct Schema
A named struct type. Owns its TypeStore.
root is the index of the top-level struct node; by_id / by_name are
flattened indexes over all nested fields, built once at construction.
Nested names are dotted (addr.city); list elements use .element, map
keys/values .key / .value, matching the reference implementations.
Implements Copyable, Movable
- Fields
store: TypeStoreroot: Intschema_id: Intidentifier_field_ids: List[Int]flat: List[AccessorField]
__init__
def __init__(out self, var store: TypeStore, root: Int, schema_id: Int)
find_index
def find_index(self, id: Int) -> Int
Position in flat of field id, or -1.
find_field
def find_field(self, id: Int) -> AccessorField
has_field
def has_field(self, id: Int) -> Bool
find_by_name
def find_by_name(self, name: String) -> AccessorField
find_name_index
def find_name_index(self, name: String) -> Int
Case-sensitive first, then case-insensitive (Iceberg allows both).
has_name
def has_name(self, name: String) -> Bool
name_of
def name_of(self, id: Int) -> String
columns
def columns(self) -> List[NestedField]
The top-level fields only.
top_ancestor_id
def top_ancestor_id(self, id: Int) -> Int
The id of the top-level column id lives in, or id itself.
struct_path
def struct_path(self, id: Int) -> List[Int]
Child positions from the top-level column down to field id.
Empty for a top-level field. Raises when the path crosses a list
element or a map key/value, which a dotted name cannot address and a
row predicate cannot evaluate.
in_struct_only
def in_struct_only(self, id: Int) -> Bool
True when id is reachable from the top through structs alone.
is_top_level
def is_top_level(self, id: Int) -> Bool
column_type
def column_type(self, id: Int) -> Self
A one-column schema holding just the type of field id.
select
def select(self, ids: List[Int]) -> Self
Project to the named ids, keeping ancestors of any selected field.
Selecting a nested field keeps the structs above it and prunes the
ones beside it: select(["a.b"]) gives back a struct a whose only
field is b. Selecting a whole nested column keeps all of it. A list
or a map is never partially selected — its element type is pruned when
the selection reaches inside it, but the container itself stays.
highest_field_id
def highest_field_id(self) -> Int
from_json
def from_json(doc: Json, i: Int) -> Self
parse
def parse(text: String) -> Self
to_json
def to_json(self) -> String