SortOrderPushdownResult

Enum SortOrderPushdownResult 

Source
pub enum SortOrderPushdownResult<T> {
    Exact {
        inner: T,
    },
    Inexact {
        inner: T,
    },
    Unsupported,
}
Expand description

Result of attempting to push down sort ordering to a node.

Used by ExecutionPlan::try_pushdown_sort to communicate whether and how sort ordering was successfully pushed down.

Variants§

§

Exact

The source can guarantee exact ordering (data is perfectly sorted).

When this is returned, the optimizer can safely remove the Sort operator entirely since the data source guarantees the requested ordering.

Fields

§inner: T

The optimized node that provides exact ordering

§

Inexact

The source has optimized for the ordering but cannot guarantee perfect sorting.

This indicates the data source has been optimized (e.g., reordered files/row groups based on statistics, enabled reverse scanning) but the data may not be perfectly sorted. The optimizer should keep the Sort operator but benefits from the optimization (e.g., faster TopK queries due to early termination).

Fields

§inner: T

The optimized node that provides approximate ordering

§

Unsupported

The source cannot optimize for this ordering.

The data source does not support the requested sort ordering and no optimization was applied.

Implementations§

Source§

impl<T> SortOrderPushdownResult<T>

Source

pub fn into_inner(self) -> Option<T>

Extract the inner value if present

Source

pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> SortOrderPushdownResult<U>

Map the inner value to a different type while preserving the variant.

Source

pub fn try_map<U, E, F: FnOnce(T) -> Result<U, E>>( self, f: F, ) -> Result<SortOrderPushdownResult<U>, E>

Try to map the inner value, returning an error if the function fails.

Source

pub fn into_inexact(self) -> Self

Convert this result to Inexact, downgrading Exact if present.

This is useful when an operation (like merging multiple partitions) cannot guarantee exact ordering even if the input provides it.

§Examples
let exact = SortOrderPushdownResult::Exact { inner: 42 };
let inexact = exact.into_inexact();
assert!(matches!(inexact, SortOrderPushdownResult::Inexact { inner: 42 }));

let already_inexact = SortOrderPushdownResult::Inexact { inner: 42 };
let still_inexact = already_inexact.into_inexact();
assert!(matches!(still_inexact, SortOrderPushdownResult::Inexact { inner: 42 }));

let unsupported = SortOrderPushdownResult::<i32>::Unsupported;
let still_unsupported = unsupported.into_inexact();
assert!(matches!(still_unsupported, SortOrderPushdownResult::Unsupported));

Trait Implementations§

Source§

impl<T: Clone> Clone for SortOrderPushdownResult<T>

Source§

fn clone(&self) -> SortOrderPushdownResult<T>

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<T: Debug> Debug for SortOrderPushdownResult<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for SortOrderPushdownResult<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SortOrderPushdownResult<T>
where T: RefUnwindSafe,

§

impl<T> Send for SortOrderPushdownResult<T>
where T: Send,

§

impl<T> Sync for SortOrderPushdownResult<T>
where T: Sync,

§

impl<T> Unpin for SortOrderPushdownResult<T>
where T: Unpin,

§

impl<T> UnwindSafe for SortOrderPushdownResult<T>
where T: UnwindSafe,

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

Source§

impl<T> ErasedDestructor for T
where T: 'static,