pub struct Schema {
pub fields: Vec<Field>,
pub metadata: HashMap<String, String>,
}Expand description
Lance Schema.
Fields§
§fields: Vec<Field>Top-level fields in the dataset.
metadata: HashMap<String, String>Metadata of the schema
Implementations§
source§impl Schema
impl Schema
sourcepub fn project<T: AsRef<str>>(&self, columns: &[T]) -> Result<Self>
pub fn project<T: AsRef<str>>(&self, columns: &[T]) -> Result<Self>
Project the columns over the schema.
ⓘ
let schema = Schema::from(...);
let projected = schema.project(&["col1", "col2.sub_col3.field4"])?;sourcepub fn intersection(&self, other: &Self) -> Result<Self>
pub fn intersection(&self, other: &Self) -> Result<Self>
Intersection between two Schema.
sourcepub fn project_by_ids(&self, column_ids: &[i32]) -> Self
pub fn project_by_ids(&self, column_ids: &[i32]) -> Self
Returns a new schema that only contains the fields in column_ids.
This projection can filter out both top-level and nested fields
sourcepub fn project_by_schema<S: TryInto<Self, Error = Error>>(
&self,
projection: S
) -> Result<Self>
pub fn project_by_schema<S: TryInto<Self, Error = Error>>( &self, projection: S ) -> Result<Self>
Project the schema by another schema, and preserves field metadata, i.e., Field IDs.
Parameters
projection: The schema to project by. Can bearrow_schema::SchemaorSchema.
sourcepub fn exclude<T: TryInto<Self> + Debug>(&self, schema: T) -> Result<Self>
pub fn exclude<T: TryInto<Self> + Debug>(&self, schema: T) -> Result<Self>
Exclude the fields from other Schema, and returns a new Schema.
Trait Implementations§
source§impl From<&Schema> for (Vec<Field>, HashMap<String, Vec<u8>>)
impl From<&Schema> for (Vec<Field>, HashMap<String, Vec<u8>>)
Convert a Schema to a list of protobuf Field and Metadata
source§impl From<(&Vec<Field>, HashMap<String, Vec<u8>>)> for Schema
impl From<(&Vec<Field>, HashMap<String, Vec<u8>>)> for Schema
Convert list of protobuf Field and Metadata to a Schema.
source§impl PartialEq for Schema
impl PartialEq for Schema
Auto Trait Implementations§
impl !RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl !UnwindSafe for Schema
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
Mutably borrows from an owned value. Read more