Struct polars_core::prelude::ArrowSchema [−][src]
pub struct ArrowSchema { /* fields omitted */ }
Expand description
An ordered sequence of Field
with optional metadata.
Implementations
Creates a new Schema
from a sequence of Field
values
and additional metadata.
Example
let field_a = Field::new("a", DataType::Int64, false);
let field_b = Field::new("b", DataType::Boolean, false);
let mut metadata: HashMap<String, String> = HashMap::new();
metadata.insert("row_count".to_string(), "100".to_string());
let schema = Schema::new_from(vec![field_a, field_b], metadata);
Creates a new Field
with metadata.
Merge schema into self if it is compatible. Struct fields will be merged recursively.
Example:
use arrow2::datatypes::*;
let merged = Schema::try_merge(vec![
Schema::new(vec![
Field::new("c1", DataType::Int64, false),
Field::new("c2", DataType::Utf8, false),
]),
Schema::new(vec![
Field::new("c1", DataType::Int64, true),
Field::new("c2", DataType::Utf8, false),
Field::new("c3", DataType::Utf8, false),
]),
]).unwrap();
assert_eq!(
merged,
Schema::new(vec![
Field::new("c1", DataType::Int64, true),
Field::new("c2", DataType::Utf8, false),
Field::new("c3", DataType::Utf8, false),
]),
);
Returns the first Field
named name
.
Returns all Field
s with dictionary id dict_id
.
Find the index of the column with the given name.
Returns an immutable reference to the Map of custom metadata key-value pairs.
Trait Implementations
Performs the conversion.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Schema
impl UnwindSafe for Schema
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.