Skip to main content

StructField

Struct StructField 

Source
pub struct StructField {
    pub name: String,
    pub data_type: DataType,
    pub nullable: bool,
    pub metadata: HashMap<String, MetadataValue>,
}

Fields§

§name: String

Name of this (possibly nested) column

§data_type: DataType

The data type of this field

§nullable: bool

Denotes whether this Field can be null

§metadata: HashMap<String, MetadataValue>

A JSON map containing information about this column

Implementations§

Source§

impl StructField

Source

pub fn new( name: impl Into<String>, data_type: impl Into<DataType>, nullable: bool, ) -> Self

Creates a new field

Source

pub fn nullable(name: impl Into<String>, data_type: impl Into<DataType>) -> Self

Creates a new nullable field

Source

pub fn not_null(name: impl Into<String>, data_type: impl Into<DataType>) -> Self

Creates a new non-nullable field

Source

pub fn create_metadata_column( name: impl Into<String>, spec: MetadataColumnSpec, ) -> Self

Creates a metadata column of the given spec with the given name.

Source

pub fn default_row_index_column() -> &'static StructField

Returns the default row index metadata column used by Kernel.

Source

pub fn with_metadata( self, metadata: impl IntoIterator<Item = (impl Into<String>, impl Into<MetadataValue>)>, ) -> Self

Replaces self.metadata with the list of <key, value> pairs in metadata.

Source

pub fn add_metadata( self, metadata: impl IntoIterator<Item = (impl Into<String>, impl Into<MetadataValue>)>, ) -> Self

Extends self.metadata to include the <key, value> pairs in metadata.

Source

pub fn is_metadata_column(&self) -> bool

Returns true if this field is a metadata column.

Source

pub fn get_metadata_column_spec(&self) -> Option<MetadataColumnSpec>

Returns the metadata column spec if this is a metadata column, otherwise returns None.

Source

pub fn is_internal_column(&self) -> bool

Returns true if this field is an internal column added by Kernel.

Internal columns must be removed before returning scan results to the user.

Source

pub fn as_internal_column(self) -> Self

Marks this field as an internal column.

Source

pub fn get_config_value( &self, key: &ColumnMetadataKey, ) -> Option<&MetadataValue>

Source

pub fn physical_name(&self, column_mapping_mode: ColumnMappingMode) -> &str

Available on crate feature internal-api only.

Get the physical name for this field as it should be read from parquet.

When column_mapping_mode is None, always returns the logical name (even if physical name metadata is present). When mode is Id or Name, returns the physical name from metadata if present, otherwise returns the logical name.

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.

Source

pub fn with_name(&self, new_name: impl Into<String>) -> Self

Change the name of a field. The field will preserve its data type and nullability. Note that this allocates a new field.

Source

pub fn name(&self) -> &String

Source

pub fn is_nullable(&self) -> bool

Source

pub const fn data_type(&self) -> &DataType

Source

pub const fn metadata(&self) -> &HashMap<String, MetadataValue>

Source

pub fn metadata_with_string_values(&self) -> HashMap<String, String>

Convert our metadata into a HashMap<String, String>. Note this copies all the data so can be expensive for large metadata

Source

pub fn make_physical(&self, column_mapping_mode: ColumnMappingMode) -> Self

Available on crate feature internal-api only.

Applies physical name and field ID mappings to this field.

This function sets the field ID for the physical StructField only if the column_mapping_mode is Id. The field ID is specified using the ColumnMetadataKey::ParquetFieldId metadata field. Readers should use ColumnMetadataKey::ParquetFieldId to match fields to the Parquet schema. If a physical StructField contains a field ID, the reader must resolve columns with that ID. Otherwise, the physical StructField’s name is used. For details, see read_parquet_files.

This function also sets the physical name of a field. If column_mapping_mode is Id or Name, this is specified in ColumnMetadataKey::ColumnMappingPhysicalName. Otherwise, the field’s logical name is used.

If the column_mapping_mode is None, then all column mapping metadata is removed. If the column_mapping_mode is Name, then all Id mode column mapping metadata is removed.

NOTE: The caller must ensure that the schema has been validated by crate::table_features::validate_schema_column_mapping to ensure that annotations are present only when column mapping mode is enabled.

Trait Implementations§

Source§

impl Clone for StructField

Source§

fn clone(&self) -> StructField

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StructField

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StructField

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for StructField

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for StructField

Source§

fn eq(&self, other: &StructField) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for StructField

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFromArrow<&Field> for StructField

Available on crate feature arrow-conversion and (crate features default-engine-native-tls or default-engine-rustls or arrow-conversion) only.
Source§

impl TryFromKernel<&StructField> for Field

Available on crate feature arrow-conversion and (crate features default-engine-native-tls or default-engine-rustls or arrow-conversion) only.
Source§

impl Eq for StructField

Source§

impl StructuralPartialEq for StructField

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any + Send + Sync,

Source§

fn any_ref(&self) -> &(dyn Any + Send + Sync + 'static)

Obtains a dyn Any reference to the object: Read more
Source§

fn as_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Obtains an Arc<dyn Any> reference to the object: Read more
Source§

fn into_any(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts the object to Box<dyn Any>: Read more
Source§

fn type_name(&self) -> &'static str

Convenient wrapper for 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> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynPartialEq for T
where T: PartialEq + AsAny,

Source§

fn dyn_eq(&self, other: &(dyn Any + 'static)) -> bool

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<KernelType, ArrowType> TryIntoArrow<ArrowType> for KernelType
where ArrowType: TryFromKernel<KernelType>,

Source§

fn try_into_arrow(self) -> Result<ArrowType, ArrowError>

Available on (crate features default-engine-native-tls or default-engine-rustls or arrow-conversion) and crate feature arrow-conversion only.
Source§

impl<KernelType, ArrowType> TryIntoKernel<KernelType> for ArrowType
where KernelType: TryFromArrow<ArrowType>,

Source§

fn try_into_kernel(self) -> Result<KernelType, ArrowError>

Available on (crate features default-engine-native-tls or default-engine-rustls or arrow-conversion) and crate feature arrow-conversion only.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,