datafusion_optimizer::decorrelate

Struct PullUpCorrelatedExpr

Source
pub struct PullUpCorrelatedExpr {
    pub join_filters: Vec<Expr>,
    pub correlated_subquery_cols_map: HashMap<LogicalPlan, BTreeSet<Column>>,
    pub in_predicate_opt: Option<Expr>,
    pub exists_sub_query: bool,
    pub can_pull_up: bool,
    pub need_handle_count_bug: bool,
    pub collected_count_expr_map: HashMap<LogicalPlan, ExprResultMap>,
    pub pull_up_having_expr: Option<Expr>,
    /* private fields */
}
Expand description

This struct rewrite the sub query plan by pull up the correlated expressions(contains outer reference columns) from the inner subquery’s ‘Filter’. It adds the inner reference columns to the ‘Projection’ or ‘Aggregate’ of the subquery if they are missing, so that they can be evaluated by the parent operator as the join condition.

Fields§

§join_filters: Vec<Expr>§correlated_subquery_cols_map: HashMap<LogicalPlan, BTreeSet<Column>>

mapping from the plan to its holding correlated columns

§in_predicate_opt: Option<Expr>§exists_sub_query: bool

Is this an Exists(Not Exists) SubQuery. Defaults to FALSE

§can_pull_up: bool

Can the correlated expressions be pulled up. Defaults to TRUE

§need_handle_count_bug: bool

Do we need to handle the Count bug during the pull up process

§collected_count_expr_map: HashMap<LogicalPlan, ExprResultMap>

mapping from the plan to its expressions’ evaluation result on empty batch

§pull_up_having_expr: Option<Expr>

pull up having expr, which must be evaluated after the Join

Implementations§

Source§

impl PullUpCorrelatedExpr

Source

pub fn new() -> Self

Source

pub fn with_need_handle_count_bug(self, need_handle_count_bug: bool) -> Self

Set if we need to handle the Count bug during the pull up process

Source

pub fn with_in_predicate_opt(self, in_predicate_opt: Option<Expr>) -> Self

Set the in_predicate_opt

Source

pub fn with_exists_sub_query(self, exists_sub_query: bool) -> Self

Set if this is an Exists(Not Exists) SubQuery

Trait Implementations§

Source§

impl Debug for PullUpCorrelatedExpr

Source§

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

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

impl Default for PullUpCorrelatedExpr

Source§

fn default() -> Self

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

impl TreeNodeRewriter for PullUpCorrelatedExpr

Source§

type Node = LogicalPlan

The node type which is rewritable.
Source§

fn f_down(&mut self, plan: LogicalPlan) -> Result<Transformed<LogicalPlan>>

Invoked while traversing down the tree before any children are rewritten. Default implementation returns the node as is and continues recursion.
Source§

fn f_up(&mut self, plan: LogicalPlan) -> Result<Transformed<LogicalPlan>>

Invoked while traversing up the tree after all children have been rewritten. Default implementation returns the node as is and continues recursion.

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> 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, 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.