pub struct MappingSchema { /* private fields */ }Expand description
A schema backed by in-memory hash maps, supporting 3-level nesting:
catalog → database → table → column → type.
Analogous to Python sqlglot’s MappingSchema.
Identifiers are normalized according to the configured dialect:
- Case-insensitive dialects (most): identifiers are lowercased for lookup.
- Case-sensitive dialects (e.g. BigQuery, Hive): identifiers are kept as-is.
- Quoted identifiers are always stored verbatim (not normalized).
Implementations§
Source§impl MappingSchema
impl MappingSchema
Sourcepub fn replace_table(
&mut self,
table_path: &[&str],
columns: Vec<(String, DataType)>,
) -> Result<(), SchemaError>
pub fn replace_table( &mut self, table_path: &[&str], columns: Vec<(String, DataType)>, ) -> Result<(), SchemaError>
Replace a table if it already exists, or add it if it doesn’t.
Sourcepub fn remove_table(&mut self, table_path: &[&str]) -> Result<bool, SchemaError>
pub fn remove_table(&mut self, table_path: &[&str]) -> Result<bool, SchemaError>
Remove a table from the schema. Returns true if the table existed.
Sourcepub fn add_udf(&mut self, name: &str, return_type: DataType)
pub fn add_udf(&mut self, name: &str, return_type: DataType)
Register a UDF (user-defined function) with its return type.
Sourcepub fn get_udf_type(&self, name: &str) -> Option<&DataType>
pub fn get_udf_type(&self, name: &str) -> Option<&DataType>
Get the return type of a registered UDF.
Trait Implementations§
Source§impl Clone for MappingSchema
impl Clone for MappingSchema
Source§fn clone(&self) -> MappingSchema
fn clone(&self) -> MappingSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MappingSchema
impl Debug for MappingSchema
Source§impl Schema for MappingSchema
impl Schema for MappingSchema
Source§fn add_table(
&mut self,
table_path: &[&str],
columns: Vec<(String, DataType)>,
) -> Result<(), SchemaError>
fn add_table( &mut self, table_path: &[&str], columns: Vec<(String, DataType)>, ) -> Result<(), SchemaError>
Register a table with its column definitions. Read more
Source§fn column_names(&self, table_path: &[&str]) -> Result<Vec<String>, SchemaError>
fn column_names(&self, table_path: &[&str]) -> Result<Vec<String>, SchemaError>
Get the column names for a table, in definition order. Read more
Source§fn get_column_type(
&self,
table_path: &[&str],
column: &str,
) -> Result<DataType, SchemaError>
fn get_column_type( &self, table_path: &[&str], column: &str, ) -> Result<DataType, SchemaError>
Get the data type of a specific column in a table. Read more
Auto Trait Implementations§
impl Freeze for MappingSchema
impl RefUnwindSafe for MappingSchema
impl Send for MappingSchema
impl Sync for MappingSchema
impl Unpin for MappingSchema
impl UnsafeUnpin for MappingSchema
impl UnwindSafe for MappingSchema
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