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(
qualifier: &str,
schema: &Schema
) -> Result<Self>
pub fn try_from_qualified_schema(
qualifier: &str,
schema: &Schema
) -> Result<Self>
Create a DFSchema
from an Arrow schema
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<&str>,
name: &str
) -> Result<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 field_with_name(
&self,
qualifier: Option<&str>,
name: &str
) -> Result<&DFField>
pub fn field_with_name(
&self,
qualifier: Option<&str>,
name: &str
) -> Result<&DFField>
Find the field with the given name
sourcepub fn fields_with_qualified(&self, qualifier: &str) -> Vec<&DFField> ⓘ
pub fn fields_with_qualified(&self, qualifier: &str) -> 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: &str,
name: &str
) -> Result<&DFField>
pub fn field_with_qualified_name(
&self,
qualifier: &str,
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 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: &str) -> Self
pub fn replace_qualifier(self, qualifier: &str) -> 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