Skip to main content

Resolver

Struct Resolver 

Source
pub struct Resolver<'a> {
    pub scope: &'a Scope,
    pub dialect: Option<DialectType>,
    /* private fields */
}
Expand description

Helper for resolving columns to their source tables.

This is a struct so we can lazily load some things and easily share them across functions.

Fields§

§scope: &'a Scope

The scope being analyzed

§dialect: Option<DialectType>

The dialect being used

Implementations§

Source§

impl<'a> Resolver<'a>

Source

pub fn new(scope: &'a Scope, schema: &'a dyn Schema, infer_schema: bool) -> Self

Create a new resolver for a scope

Source

pub fn get_table(&mut self, column_name: &str) -> Option<String>

Get the table for a column name.

Returns the table name if it can be found/inferred.

Source

pub fn get_table_identifier(&mut self, column_name: &str) -> Option<Identifier>

Get the table for a column, returning an Identifier

Source

pub fn all_columns(&mut self) -> &HashSet<String>

Get all available columns across all sources in this scope

Source

pub fn get_source_columns( &mut self, source_name: &str, ) -> ResolverResult<Vec<String>>

Get column names for a source.

Returns the list of column names available from the given source.

Source

pub fn get_source_columns_from_set_op( &self, expression: &Expression, ) -> ResolverResult<Vec<String>>

Get columns from a set operation (UNION, INTERSECT, EXCEPT)

Source

pub fn is_ambiguous(&mut self, column_name: &str) -> bool

Check if a column is ambiguous (appears in multiple sources)

Source

pub fn sources_for_column(&mut self, column_name: &str) -> Vec<String>

Get all sources that contain a given column

Source

pub fn disambiguate_in_join_context( &mut self, column_name: &str, available_sources: &[String], ) -> Option<String>

Try to disambiguate a column based on join context

In join conditions, a column can sometimes be disambiguated based on which tables have been joined up to that point.

Auto Trait Implementations§

§

impl<'a> Freeze for Resolver<'a>

§

impl<'a> !RefUnwindSafe for Resolver<'a>

§

impl<'a> !Send for Resolver<'a>

§

impl<'a> !Sync for Resolver<'a>

§

impl<'a> Unpin for Resolver<'a>

§

impl<'a> !UnwindSafe for Resolver<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.