pub struct Schema { /* private fields */ }Expand description
Defines schema in iceberg.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn builder() -> SchemaBuilder
pub fn builder() -> SchemaBuilder
Create a schema builder.
Sourcepub fn into_builder(self) -> SchemaBuilder
pub fn into_builder(self) -> SchemaBuilder
Create a new schema builder from a schema.
Sourcepub fn field_by_id(&self, field_id: i32) -> Option<&NestedFieldRef>
pub fn field_by_id(&self, field_id: i32) -> Option<&NestedFieldRef>
Get field by field id.
Sourcepub fn field_by_name(&self, field_name: &str) -> Option<&NestedFieldRef>
pub fn field_by_name(&self, field_name: &str) -> Option<&NestedFieldRef>
Get field by field name.
Both full name and short name could work here.
Sourcepub fn field_by_name_case_insensitive(
&self,
field_name: &str,
) -> Option<&NestedFieldRef>
pub fn field_by_name_case_insensitive( &self, field_name: &str, ) -> Option<&NestedFieldRef>
Get field by field name, but in case-insensitive way.
Both full name and short name could work here.
Sourcepub fn field_by_alias(&self, alias: &str) -> Option<&NestedFieldRef>
pub fn field_by_alias(&self, alias: &str) -> Option<&NestedFieldRef>
Get field by alias.
Sourcepub fn highest_field_id(&self) -> i32
pub fn highest_field_id(&self) -> i32
Returns [highest_field_id].
Sourcepub fn as_struct(&self) -> &StructType
pub fn as_struct(&self) -> &StructType
Returns [r#struct].
Sourcepub fn identifier_field_ids(&self) -> impl ExactSizeIterator<Item = i32> + '_
pub fn identifier_field_ids(&self) -> impl ExactSizeIterator<Item = i32> + '_
Returns [identifier_field_ids].
Sourcepub fn field_id_by_name(&self, name: &str) -> Option<i32>
pub fn field_id_by_name(&self, name: &str) -> Option<i32>
Get field id by full name.
Sourcepub fn name_by_field_id(&self, field_id: i32) -> Option<&str>
pub fn name_by_field_id(&self, field_id: i32) -> Option<&str>
Get full name by field id.
Sourcepub fn accessor_by_field_id(&self, field_id: i32) -> Option<Arc<StructAccessor>>
pub fn accessor_by_field_id(&self, field_id: i32) -> Option<Arc<StructAccessor>>
Get an accessor for retrieving data in a struct
Sourcepub fn field_id_to_name_map(&self) -> &HashMap<i32, String>
pub fn field_id_to_name_map(&self) -> &HashMap<i32, String>
Return A HashMap matching field ids to field names.
Sourcepub fn field_id_to_fields(&self) -> &HashMap<i32, NestedFieldRef>
pub fn field_id_to_fields(&self) -> &HashMap<i32, NestedFieldRef>
Return a hashmap matching field ids to nested fields.
Sourcepub fn calc_min_compatible_format(&self) -> FormatVersion
pub fn calc_min_compatible_format(&self) -> FormatVersion
Minimum FormatVersion required to represent all types in this schema.
Walks the whole schema — every field, nested ones included — and returns the
highest per-type floor, so this is O(fields) rather than a cheap field read.
Types only; for initial-default version floors see Schema::check_format_compatibility.
Sourcepub fn check_format_compatibility(
&self,
format_version: FormatVersion,
) -> Result<()>
pub fn check_format_compatibility( &self, format_version: FormatVersion, ) -> Result<()>
Returns an error listing every field incompatible with format_version.
Mirrors Java’s Schema.checkCompatibility(). Two checks per field:
- Type — minimum format version required to support that type, without taking nested field types into account.
- Initial default — a non-null
initial_defaultbackfills pre-existing rows, so it requiresDEFAULT_VALUES_MIN_FORMAT_VERSION;write_defaultis not checked, as it only affects newly written rows (read identically at any version).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Schema
Auto Trait Implementations§
impl !Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more