pub struct DFSchema { /* private fields */ }
Expand description

DFSchema wraps an Arrow schema and adds relation names

Implementations§

source§

impl DFSchema

source

pub fn empty() -> Self

Creates an empty DFSchema

source

pub fn new(fields: Vec<DFField>) -> Result<Self>

👎Deprecated since 7.0.0: please use new_with_metadata instead

Create a new DFSchema

source

pub fn new_with_metadata( fields: Vec<DFField>, metadata: HashMap<String, String> ) -> Result<Self>

Create a new DFSchema

source

pub fn try_from_qualified_schema<'a>( qualifier: impl Into<TableReference<'a>>, schema: &Schema ) -> Result<Self>

Create a DFSchema from an Arrow schema and a given qualifier

source

pub fn with_functional_dependencies( self, functional_dependencies: FunctionalDependencies ) -> Self

Assigns functional dependencies.

source

pub fn join(&self, schema: &DFSchema) -> Result<Self>

Create a new schema that contains the fields from this schema followed by the fields from the supplied schema. An error will be returned if there are duplicate field names.

source

pub fn merge(&mut self, other_schema: &DFSchema)

Modify this schema by appending the fields from the supplied schema, ignoring any duplicate fields.

source

pub fn fields(&self) -> &Vec<DFField>

Get a list of fields

source

pub fn field(&self, i: usize) -> &DFField

Returns an immutable reference of a specific Field instance selected using an offset within the internal fields vector

source

pub fn index_of(&self, name: &str) -> Result<usize>

👎Deprecated since 8.0.0: please use index_of_column_by_name instead

Find the index of the column with the given unqualified name

source

pub fn index_of_column_by_name( &self, qualifier: Option<&TableReference<'_>>, name: &str ) -> Result<Option<usize>>

source

pub fn index_of_column(&self, col: &Column) -> Result<usize>

Find the index of the column with the given qualifier and name

source

pub fn is_column_from_schema(&self, col: &Column) -> Result<bool>

Check if the column is in the current schema

source

pub fn field_with_name( &self, qualifier: Option<&TableReference<'_>>, name: &str ) -> Result<&DFField>

Find the field with the given name

source

pub fn fields_with_qualified( &self, qualifier: &TableReference<'_> ) -> Vec<&DFField>

Find all fields having the given qualifier

source

pub fn fields_with_unqualified_name(&self, name: &str) -> Vec<&DFField>

Find all fields match the given name

source

pub fn field_with_unqualified_name(&self, name: &str) -> Result<&DFField>

Find the field with the given name

source

pub fn field_with_qualified_name( &self, qualifier: &TableReference<'_>, name: &str ) -> Result<&DFField>

Find the field with the given qualified name

source

pub fn field_from_column(&self, column: &Column) -> Result<&DFField>

Find the field with the given qualified column

source

pub fn has_column_with_unqualified_name(&self, name: &str) -> bool

Find if the field exists with the given name

source

pub fn has_column_with_qualified_name( &self, qualifier: &TableReference<'_>, name: &str ) -> bool

Find if the field exists with the given qualified name

source

pub fn has_column(&self, column: &Column) -> bool

Find if the field exists with the given qualified column

source

pub fn matches_arrow_schema(&self, arrow_schema: &Schema) -> bool

Check to see if unqualified field names matches field names in Arrow schema

source

pub fn check_arrow_schema_type_compatible( &self, arrow_schema: &Schema ) -> Result<()>

Check to see if fields in 2 Arrow schemas are compatible

source

pub fn equivalent_names_and_types(&self, other: &Self) -> bool

Returns true if the two schemas have the same qualified named fields with the same data types. Returns false otherwise.

This is a specialized version of Eq that ignores differences in nullability and metadata.

source

pub fn strip_qualifiers(self) -> Self

Strip all field qualifier in schema

source

pub fn replace_qualifier( self, qualifier: impl Into<OwnedTableReference> ) -> Self

Replace all field qualifier with new value in schema

source

pub fn field_names(&self) -> Vec<String>

Get list of fully-qualified field names in this schema

source

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

Get metadata of this schema

source

pub fn functional_dependencies(&self) -> &FunctionalDependencies

Get functional dependencies

Trait Implementations§

source§

impl Clone for DFSchema

source§

fn clone(&self) -> DFSchema

Returns a copy 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 DFSchema

source§

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

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

impl Display for DFSchema

source§

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

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

impl ExprSchema for DFSchema

source§

fn nullable(&self, col: &Column) -> Result<bool>

Is this column reference nullable?
source§

fn data_type(&self, col: &Column) -> Result<&DataType>

What is the datatype of this column?
source§

fn metadata(&self, col: &Column) -> Result<&HashMap<String, String>>

Returns the column’s optional metadata.
source§

impl From<&DFSchema> for Schema

source§

fn from(df_schema: &DFSchema) -> Self

Convert DFSchema reference into a Schema

source§

impl From<DFSchema> for Schema

source§

fn from(df_schema: DFSchema) -> Self

Convert DFSchema into a Schema

source§

impl From<DFSchema> for SchemaRef

source§

fn from(df_schema: DFSchema) -> Self

Converts to this type from the input type.
source§

impl Hash for DFSchema

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<DFSchema> for DFSchema

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<Schema> for DFSchema

Create a DFSchema from an Arrow schema

§

type Error = DataFusionError

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

fn try_from(schema: Schema) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for DFSchema

source§

impl StructuralEq for DFSchema

source§

impl StructuralPartialEq for DFSchema

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

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

§

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

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

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

§

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, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

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