pub struct StructType {
pub type_name: String,
pub fields: IndexMap<String, StructField>,
}
Expand description
A struct is used to represent both the top-level schema of the table as well as struct columns that contain nested columns.
Fields§
§type_name: String
§fields: IndexMap<String, StructField>
The type of element stored in this array
Implementations§
Source§impl StructType
impl StructType
pub fn new(fields: impl IntoIterator<Item = StructField>) -> Self
pub fn try_new<E>( fields: impl IntoIterator<Item = Result<StructField, E>>, ) -> Result<Self, E>
Sourcepub fn project_as_struct(
&self,
names: &[impl AsRef<str>],
) -> DeltaResult<StructType>
pub fn project_as_struct( &self, names: &[impl AsRef<str>], ) -> DeltaResult<StructType>
Get a StructType
containing StructField
s of the given names. The order of fields in
the returned schema will match the order passed to this function, which can be different
from this order in this schema. Returns an Err if a specified field doesn’t exist.
Sourcepub fn project(&self, names: &[impl AsRef<str>]) -> DeltaResult<SchemaRef>
pub fn project(&self, names: &[impl AsRef<str>]) -> DeltaResult<SchemaRef>
Get a SchemaRef
containing StructField
s of the given names. The order of fields in
the returned schema will match the order passed to this function, which can be different
from this order in this schema. Returns an Err if a specified field doesn’t exist.
pub fn field(&self, name: impl AsRef<str>) -> Option<&StructField>
pub fn index_of(&self, name: impl AsRef<str>) -> Option<usize>
pub fn fields(&self) -> impl Iterator<Item = &StructField>
Sourcepub fn leaves<'s>(
&self,
own_name: impl Into<Option<&'s str>>,
) -> ColumnNamesAndTypes
Available on crate feature internal-api
only.
pub fn leaves<'s>( &self, own_name: impl Into<Option<&'s str>>, ) -> ColumnNamesAndTypes
internal-api
only.Extracts the name and type of all leaf columns, in schema order. Caller should pass Some
own_name
if this schema is embedded in a larger struct (e.g. add.*
) and None if the
schema is a top-level result (e.g. *
).
NOTE: This method only traverses through StructType
fields; MapType
and ArrayType
fields are considered leaves even if they contain StructType
entries/elements.
Sourcepub fn make_physical(&self, column_mapping_mode: ColumnMappingMode) -> Self
Available on crate feature internal-api
only.
pub fn make_physical(&self, column_mapping_mode: ColumnMappingMode) -> Self
internal-api
only.Applies physical name mappings to this field. If the column_mapping_mode
is
ColumnMappingMode::Id
, then each StructField will have its parquet field id in the
ColumnMetadataKey::ParquetFieldId
metadata field.
NOTE: Caller affirms that the schema was already validated by
crate::table_features::validate_schema_column_mapping
, to ensure that annotations are
always and only present when column mapping mode is enabled.
Trait Implementations§
Source§impl Clone for StructType
impl Clone for StructType
Source§fn clone(&self) -> StructType
fn clone(&self) -> StructType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StructType
impl Debug for StructType
Source§impl<'de> Deserialize<'de> for StructType
impl<'de> Deserialize<'de> for StructType
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Self: Sized,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Self: Sized,
Source§impl From<StructType> for DataType
impl From<StructType> for DataType
Source§fn from(struct_type: StructType) -> Self
fn from(struct_type: StructType) -> Self
Source§impl PartialEq for StructType
impl PartialEq for StructType
Source§impl Serialize for StructType
impl Serialize for StructType
Source§impl TryFromArrow<&Schema> for StructType
Available on crate feature arrow-conversion
and (crate features default-engine
or arrow-conversion
) only.
impl TryFromArrow<&Schema> for StructType
arrow-conversion
and (crate features default-engine
or arrow-conversion
) only.fn try_from_arrow(arrow_schema: &ArrowSchema) -> Result<Self, ArrowError>
Source§impl TryFromArrow<Arc<Schema>> for StructType
Available on crate feature arrow-conversion
and (crate features default-engine
or arrow-conversion
) only.
impl TryFromArrow<Arc<Schema>> for StructType
arrow-conversion
and (crate features default-engine
or arrow-conversion
) only.fn try_from_arrow(arrow_schema: ArrowSchemaRef) -> Result<Self, ArrowError>
Source§impl TryFromKernel<&StructType> for Schema
Available on crate feature arrow-conversion
and (crate features default-engine
or arrow-conversion
) only.
impl TryFromKernel<&StructType> for Schema
arrow-conversion
and (crate features default-engine
or arrow-conversion
) only.fn try_from_kernel(s: &StructType) -> Result<Self, ArrowError>
impl Eq for StructType
impl StructuralPartialEq for StructType
Auto Trait Implementations§
impl Freeze for StructType
impl RefUnwindSafe for StructType
impl Send for StructType
impl Sync for StructType
impl Unpin for StructType
impl UnwindSafe for StructType
Blanket Implementations§
Source§impl<T> AsAny for T
impl<T> AsAny for T
Source§fn any_ref(&self) -> &(dyn Any + Send + Sync + 'static)
fn any_ref(&self) -> &(dyn Any + Send + Sync + 'static)
dyn Any
reference to the object: Read moreSource§fn as_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
fn as_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
Arc<dyn Any>
reference to the object: Read moreSource§fn into_any(self: Box<T>) -> Box<dyn Any + Send + Sync>
fn into_any(self: Box<T>) -> Box<dyn Any + Send + Sync>
Box<dyn Any>
: Read moreSource§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
std::any::type_name
, since Any
does not provide it and
Any::type_id
is useless as a debugging aid (its Debug
is just a mess of hex digits).Source§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,
Source§impl<T> DynPartialEq for T
impl<T> DynPartialEq for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<KernelType, ArrowType> TryIntoArrow<ArrowType> for KernelTypewhere
ArrowType: TryFromKernel<KernelType>,
impl<KernelType, ArrowType> TryIntoArrow<ArrowType> for KernelTypewhere
ArrowType: TryFromKernel<KernelType>,
Source§fn try_into_arrow(self) -> Result<ArrowType, ArrowError>
fn try_into_arrow(self) -> Result<ArrowType, ArrowError>
default-engine
or arrow-conversion
) and crate feature arrow-conversion
only.Source§impl<KernelType, ArrowType> TryIntoKernel<KernelType> for ArrowTypewhere
KernelType: TryFromArrow<ArrowType>,
impl<KernelType, ArrowType> TryIntoKernel<KernelType> for ArrowTypewhere
KernelType: TryFromArrow<ArrowType>,
Source§fn try_into_kernel(self) -> Result<KernelType, ArrowError>
fn try_into_kernel(self) -> Result<KernelType, ArrowError>
default-engine
or arrow-conversion
) and crate feature arrow-conversion
only.