pub struct PhysicalSortRequirement {
pub expr: Arc<dyn PhysicalExpr>,
pub options: Option<SortOptions>,
}Expand description
Represents sort requirement associated with a plan
If the requirement includes SortOptions then both the
expression and the sort options must match.
If the requirement does not include SortOptions) then only the
expressions must match.
§Examples
With sort options (A, DESC NULLS FIRST):
ORDER BY A DESC NULLS FIRSTmatchesORDER BY A ASC NULLS FIRSTdoes not match (ASCvsDESC)ORDER BY B DESC NULLS FIRSTdoes not match (different expr)
Without sort options (A, None):
ORDER BY A DESC NULLS FIRSTmatchesORDER BY A ASC NULLS FIRSTmatches (ASCandNULLoptions ignored)ORDER BY B DESC NULLS FIRSTdoes not match (different expr)
Fields§
§expr: Arc<dyn PhysicalExpr>Physical expression representing the column to sort
options: Option<SortOptions>Option to specify how the given column should be sorted. If unspecified, there are no constraints on sort options.
Implementations§
Source§impl PhysicalSortRequirement
impl PhysicalSortRequirement
Sourcepub fn new(
expr: Arc<dyn PhysicalExpr>,
options: Option<SortOptions>,
) -> PhysicalSortRequirement
pub fn new( expr: Arc<dyn PhysicalExpr>, options: Option<SortOptions>, ) -> PhysicalSortRequirement
Creates a new requirement.
If options is Some(..), creates an exact requirement,
which must match both options and expr.
If options is None, Creates a new expr_only requirement,
which must match only expr.
See PhysicalSortRequirement for examples.
Sourcepub fn with_expr(self, expr: Arc<dyn PhysicalExpr>) -> PhysicalSortRequirement
pub fn with_expr(self, expr: Arc<dyn PhysicalExpr>) -> PhysicalSortRequirement
Replace the required expression for this requirement with the new one
Sourcepub fn compatible(&self, other: &PhysicalSortRequirement) -> bool
pub fn compatible(&self, other: &PhysicalSortRequirement) -> bool
Returns whether this requirement is equal or more specific than other.
pub fn from_sort_exprs<'a>( ordering: impl IntoIterator<Item = &'a PhysicalSortExpr>, ) -> LexRequirement
pub fn to_sort_exprs( requirements: impl IntoIterator<Item = PhysicalSortRequirement>, ) -> LexOrdering
Trait Implementations§
Source§impl Clone for PhysicalSortRequirement
impl Clone for PhysicalSortRequirement
Source§fn clone(&self) -> PhysicalSortRequirement
fn clone(&self) -> PhysicalSortRequirement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PhysicalSortRequirement
impl Debug for PhysicalSortRequirement
Source§impl Display for PhysicalSortRequirement
impl Display for PhysicalSortRequirement
Source§impl From<PhysicalSortExpr> for PhysicalSortRequirement
impl From<PhysicalSortExpr> for PhysicalSortRequirement
Source§fn from(value: PhysicalSortExpr) -> PhysicalSortRequirement
fn from(value: PhysicalSortExpr) -> PhysicalSortRequirement
Source§impl From<PhysicalSortRequirement> for PhysicalSortExpr
impl From<PhysicalSortRequirement> for PhysicalSortExpr
Source§fn from(value: PhysicalSortRequirement) -> PhysicalSortExpr
fn from(value: PhysicalSortRequirement) -> PhysicalSortExpr
If options is None, the default sort options ASC, NULLS LAST is used.
The default is picked to be consistent with PostgreSQL: https://www.postgresql.org/docs/current/queries-order.html
Source§impl FromIterator<PhysicalSortRequirement> for LexRequirement
impl FromIterator<PhysicalSortRequirement> for LexRequirement
Source§fn from_iter<T>(iter: T) -> LexRequirementwhere
T: IntoIterator<Item = PhysicalSortRequirement>,
fn from_iter<T>(iter: T) -> LexRequirementwhere
T: IntoIterator<Item = PhysicalSortRequirement>,
Source§impl PartialEq for PhysicalSortRequirement
impl PartialEq for PhysicalSortRequirement
Auto Trait Implementations§
impl Freeze for PhysicalSortRequirement
impl !RefUnwindSafe for PhysicalSortRequirement
impl Send for PhysicalSortRequirement
impl Sync for PhysicalSortRequirement
impl Unpin for PhysicalSortRequirement
impl !UnwindSafe for PhysicalSortRequirement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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