TableArgReplace

Struct TableArgReplace 

Source
pub struct TableArgReplace {
    pub tables: Vec<(TableReference, TableFunctionArgs)>,
}
Expand description

Used to construct a AstAnalyzer that can replace table arguments.

use datafusion::sql::sqlparser::ast::{FunctionArg, Expr, Value};
use datafusion::sql::TableReference;
use datafusion_federation::sql::ast_analyzer::TableArgReplace;

let mut analyzer = TableArgReplace::default().with(
    TableReference::parse_str("table1"),
    vec![FunctionArg::Unnamed(
        Expr::value(
            Value::Number("1".to_string(), false),
        )
        .into(),
    )],
);
let analyzer = analyzer.into_analyzer();

Fields§

§tables: Vec<(TableReference, TableFunctionArgs)>

Implementations§

Source§

impl TableArgReplace

Source

pub fn new(tables: Vec<(TableReference, Vec<FunctionArg>)>) -> Self

Constructs a new TableArgReplace instance.

Source

pub fn with(self, table: TableReference, args: Vec<FunctionArg>) -> Self

Adds a new table argument replacement.

Source

pub fn into_analyzer(self) -> AstAnalyzer

Converts the TableArgReplace instance into an AstAnalyzer.

Trait Implementations§

Source§

impl Clone for TableArgReplace

Source§

fn clone(&self) -> TableArgReplace

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TableArgReplace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TableArgReplace

Source§

fn default() -> TableArgReplace

Returns the “default value” for a type. Read more
Source§

impl PartialEq for TableArgReplace

Source§

fn eq(&self, other: &TableArgReplace) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl VisitorMut for TableArgReplace

Source§

type Break = ()

Type returned when the recursion returns early.
Source§

fn pre_visit_table_factor( &mut self, table_factor: &mut TableFactor, ) -> ControlFlow<Self::Break>

Invoked for any table factors that appear in the AST before visiting children
Source§

fn pre_visit_query(&mut self, _query: &mut Query) -> ControlFlow<Self::Break>

Invoked for any queries that appear in the AST before visiting children
Source§

fn post_visit_query(&mut self, _query: &mut Query) -> ControlFlow<Self::Break>

Invoked for any queries that appear in the AST after visiting children
Source§

fn pre_visit_relation( &mut self, _relation: &mut ObjectName, ) -> ControlFlow<Self::Break>

Invoked for any relations (e.g. tables) that appear in the AST before visiting children
Source§

fn post_visit_relation( &mut self, _relation: &mut ObjectName, ) -> ControlFlow<Self::Break>

Invoked for any relations (e.g. tables) that appear in the AST after visiting children
Source§

fn post_visit_table_factor( &mut self, _table_factor: &mut TableFactor, ) -> ControlFlow<Self::Break>

Invoked for any table factors that appear in the AST after visiting children
Source§

fn pre_visit_expr(&mut self, _expr: &mut Expr) -> ControlFlow<Self::Break>

Invoked for any expressions that appear in the AST before visiting children
Source§

fn post_visit_expr(&mut self, _expr: &mut Expr) -> ControlFlow<Self::Break>

Invoked for any expressions that appear in the AST
Source§

fn pre_visit_statement( &mut self, _statement: &mut Statement, ) -> ControlFlow<Self::Break>

Invoked for any statements that appear in the AST before visiting children
Source§

fn post_visit_statement( &mut self, _statement: &mut Statement, ) -> ControlFlow<Self::Break>

Invoked for any statements that appear in the AST after visiting children
Source§

fn pre_visit_value(&mut self, _value: &mut Value) -> ControlFlow<Self::Break>

Invoked for any value that appear in the AST before visiting children
Source§

fn post_visit_value(&mut self, _value: &mut Value) -> ControlFlow<Self::Break>

Invoked for any statements that appear in the AST after visiting children
Source§

impl Eq for TableArgReplace

Source§

impl StructuralPartialEq for TableArgReplace

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynEq for T
where T: Eq + Any,

Source§

fn dyn_eq(&self, other: &(dyn Any + 'static)) -> bool

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,