Skip to main content

PathKeys

Struct PathKeys 

Source
pub struct PathKeys {
    pub keys: Vec<PathKey>,
}
Expand description

A list of pathkeys describing a plan operator’s output order. The order is lexicographic: keys[0] is the primary sort key, keys[1] breaks ties, etc.

Fields§

§keys: Vec<PathKey>

Implementations§

Source§

impl PathKeys

Source

pub fn unordered() -> PathKeys

Empty pathkeys — the plan operator makes no order guarantee.

Source

pub fn asc(field: FieldRef) -> PathKeys

Single-key pathkeys ordered by field ascending.

Source

pub fn desc(field: FieldRef) -> PathKeys

Single-key pathkeys ordered by field descending.

Source

pub fn is_unordered(&self) -> bool

True when the operator emits rows with no guaranteed order. Consumers that need a specific order must add a Sort node above.

Source

pub fn prefix_match(&self, required: &PathKeys) -> usize

Returns the number of leading pathkeys that match required. Used by the planner to decide whether to emit an incremental sort: if prefix_match returns ≥ 1, the input already satisfies a prefix of the required order and an incremental sort is cheaper than a full sort.

Example:

  • self: [a ASC, b ASC]

  • required: [a ASC, b ASC, c DESC]

  • returns: 2

  • self: [a ASC]

  • required: [b ASC, a ASC]

  • returns: 0 (prefix doesn’t match)

Source

pub fn satisfies(&self, required: &PathKeys) -> bool

True when self fully satisfies required — i.e. self.prefix_match(required) == required.keys.len() AND self has at least as many keys as required. Callers use this to decide whether a Sort node can be elided entirely.

Source

pub fn appended(&self, key: PathKey) -> PathKeys

Append a pathkey, returning a new PathKeys with one more column at the end. Used by the planner when composing pathkeys from an index scan + a tiebreaker.

Source

pub fn truncated(&self, n: usize) -> PathKeys

Truncate to the first n keys. Used when a plan operator only preserves a prefix of its input’s order (e.g. hash aggregation destroys ordering beyond the grouping columns).

Source

pub fn len(&self) -> usize

Number of pathkeys in the list.

Source

pub fn is_empty(&self) -> bool

Is the pathkey list empty?

Trait Implementations§

Source§

impl Clone for PathKeys

Source§

fn clone(&self) -> PathKeys

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PathKeys

Source§

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

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

impl Default for PathKeys

Source§

fn default() -> PathKeys

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

impl PartialEq for PathKeys

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Eq for PathKeys

Source§

impl StructuralPartialEq for PathKeys

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<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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more