Struct datafusion_common::DFSchema
source · pub struct DFSchema { /* private fields */ }
Expand description
DFSchema wraps an Arrow schema and adds relation names
Implementations§
source§impl DFSchema
impl DFSchema
sourcepub fn new(fields: Vec<DFField>) -> Result<Self>
👎Deprecated since 7.0.0: please use new_with_metadata
instead
pub fn new(fields: Vec<DFField>) -> Result<Self>
new_with_metadata
insteadCreate a new DFSchema
sourcepub fn new_with_metadata(
fields: Vec<DFField>,
metadata: HashMap<String, String>
) -> Result<Self>
pub fn new_with_metadata( fields: Vec<DFField>, metadata: HashMap<String, String> ) -> Result<Self>
Create a new DFSchema
sourcepub fn try_from_qualified_schema<'a>(
qualifier: impl Into<TableReference<'a>>,
schema: &Schema
) -> Result<Self>
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
sourcepub fn with_functional_dependencies(
self,
functional_dependencies: FunctionalDependencies
) -> Self
pub fn with_functional_dependencies( self, functional_dependencies: FunctionalDependencies ) -> Self
Assigns functional dependencies.
sourcepub fn join(&self, schema: &DFSchema) -> Result<Self>
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.
sourcepub fn merge(&mut self, other_schema: &DFSchema)
pub fn merge(&mut self, other_schema: &DFSchema)
Modify this schema by appending the fields from the supplied schema, ignoring any duplicate fields.
sourcepub fn field(&self, i: usize) -> &DFField
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
sourcepub fn index_of(&self, name: &str) -> Result<usize>
👎Deprecated since 8.0.0: please use index_of_column_by_name
instead
pub fn index_of(&self, name: &str) -> Result<usize>
index_of_column_by_name
insteadFind the index of the column with the given unqualified name
pub fn index_of_column_by_name( &self, qualifier: Option<&TableReference<'_>>, name: &str ) -> Result<Option<usize>>
sourcepub fn index_of_column(&self, col: &Column) -> Result<usize>
pub fn index_of_column(&self, col: &Column) -> Result<usize>
Find the index of the column with the given qualifier and name
sourcepub fn is_column_from_schema(&self, col: &Column) -> Result<bool>
pub fn is_column_from_schema(&self, col: &Column) -> Result<bool>
Check if the column is in the current schema
sourcepub fn field_with_name(
&self,
qualifier: Option<&TableReference<'_>>,
name: &str
) -> Result<&DFField>
pub fn field_with_name( &self, qualifier: Option<&TableReference<'_>>, name: &str ) -> Result<&DFField>
Find the field with the given name
sourcepub fn fields_with_qualified(
&self,
qualifier: &TableReference<'_>
) -> Vec<&DFField>
pub fn fields_with_qualified( &self, qualifier: &TableReference<'_> ) -> Vec<&DFField>
Find all fields having the given qualifier
sourcepub fn fields_with_unqualified_name(&self, name: &str) -> Vec<&DFField>
pub fn fields_with_unqualified_name(&self, name: &str) -> Vec<&DFField>
Find all fields match the given name
sourcepub fn field_with_unqualified_name(&self, name: &str) -> Result<&DFField>
pub fn field_with_unqualified_name(&self, name: &str) -> Result<&DFField>
Find the field with the given name
sourcepub fn field_with_qualified_name(
&self,
qualifier: &TableReference<'_>,
name: &str
) -> Result<&DFField>
pub fn field_with_qualified_name( &self, qualifier: &TableReference<'_>, name: &str ) -> Result<&DFField>
Find the field with the given qualified name
sourcepub fn field_from_column(&self, column: &Column) -> Result<&DFField>
pub fn field_from_column(&self, column: &Column) -> Result<&DFField>
Find the field with the given qualified column
sourcepub fn has_column_with_unqualified_name(&self, name: &str) -> bool
pub fn has_column_with_unqualified_name(&self, name: &str) -> bool
Find if the field exists with the given name
sourcepub fn has_column_with_qualified_name(
&self,
qualifier: &TableReference<'_>,
name: &str
) -> bool
pub fn has_column_with_qualified_name( &self, qualifier: &TableReference<'_>, name: &str ) -> bool
Find if the field exists with the given qualified name
sourcepub fn has_column(&self, column: &Column) -> bool
pub fn has_column(&self, column: &Column) -> bool
Find if the field exists with the given qualified column
sourcepub fn matches_arrow_schema(&self, arrow_schema: &Schema) -> bool
pub fn matches_arrow_schema(&self, arrow_schema: &Schema) -> bool
Check to see if unqualified field names matches field names in Arrow schema
sourcepub fn check_arrow_schema_type_compatible(
&self,
arrow_schema: &Schema
) -> Result<()>
pub fn check_arrow_schema_type_compatible( &self, arrow_schema: &Schema ) -> Result<()>
Check to see if fields in 2 Arrow schemas are compatible
sourcepub fn equivalent_names_and_types(&self, other: &Self) -> bool
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.
sourcepub fn strip_qualifiers(self) -> Self
pub fn strip_qualifiers(self) -> Self
Strip all field qualifier in schema
sourcepub fn replace_qualifier(
self,
qualifier: impl Into<OwnedTableReference>
) -> Self
pub fn replace_qualifier( self, qualifier: impl Into<OwnedTableReference> ) -> Self
Replace all field qualifier with new value in schema
sourcepub fn field_names(&self) -> Vec<String>
pub fn field_names(&self) -> Vec<String>
Get list of fully-qualified field names in this schema
sourcepub fn functional_dependencies(&self) -> &FunctionalDependencies
pub fn functional_dependencies(&self) -> &FunctionalDependencies
Get functional dependencies
Trait Implementations§
source§impl ExprSchema for DFSchema
impl ExprSchema for DFSchema
source§impl PartialEq<DFSchema> for DFSchema
impl PartialEq<DFSchema> for DFSchema
impl Eq for DFSchema
impl StructuralEq for DFSchema
impl StructuralPartialEq for DFSchema
Auto Trait Implementations§
impl RefUnwindSafe for DFSchema
impl Send for DFSchema
impl Sync for DFSchema
impl Unpin for DFSchema
impl UnwindSafe for DFSchema
Blanket Implementations§
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.