Skip to main content

PushDownLimit

Struct PushDownLimit 

Source
pub struct PushDownLimit {}
Expand description

Optimization rule that tries to push down LIMIT.

It pushes LIMIT through projections, unions, joins and into scans (taking the smaller limit when one is already present), merges adjacent limits, and pushes a Sort carrying a fetch limit (a TopK) onto a join’s preserved-side child so fewer rows enter the join. See topk_through_join for the latter.

The TopK-through-join rewrite has an implicit ordering dependency on push_down_filter and eliminate_outer_join: a Filter sitting between the Sort and the Join blocks this rule (a Filter can’t sink below a fetch-bearing node without changing which rows survive), and an outer join only has a “preserved side” once eliminate_outer_join has already dropped joins it can prove are equivalent to an inner join. Both of those rules need a prior or concurrent pass to unblock this one; with max_passes >= 2 this resolves on a later pass.

Implementations§

Source§

impl PushDownLimit

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Debug for PushDownLimit

Source§

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

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

impl Default for PushDownLimit

Source§

fn default() -> Self

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

impl OptimizerRule for PushDownLimit

Push down Limit.

Source§

fn rewrite( &self, plan: LogicalPlan, _config: &dyn OptimizerConfig, ) -> Result<Transformed<LogicalPlan>>

Try to rewrite plan to an optimized form, returning Transformed::yes if the plan was rewritten and Transformed::no if it was not. Read more
Source§

fn name(&self) -> &str

A human readable name for this optimizer rule
Source§

fn apply_order(&self) -> Option<ApplyOrder>

How should the rule be applied by the optimizer? See comments on ApplyOrder for details. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.