pub struct PhysicalSortExpr {
pub expr: Arc<dyn PhysicalExpr>,
pub options: SortOptions,
}
Expand description
Represents Sort operation for a column in a RecordBatch
Example:
// Sort by a ASC
let options = SortOptions::default();
let sort_expr = PhysicalSortExpr::new(col("a"), options);
assert_eq!(sort_expr.to_string(), "a ASC");
// Sort by a DESC NULLS LAST
let sort_expr = PhysicalSortExpr::new_default(col("a"))
.desc()
.nulls_last();
assert_eq!(sort_expr.to_string(), "a DESC NULLS LAST");
Fields§
§expr: Arc<dyn PhysicalExpr>
Physical expression representing the column to sort
options: SortOptions
Option to specify how the given column should be sorted
Implementations§
Source§impl PhysicalSortExpr
impl PhysicalSortExpr
Sourcepub fn new(expr: Arc<dyn PhysicalExpr>, options: SortOptions) -> Self
pub fn new(expr: Arc<dyn PhysicalExpr>, options: SortOptions) -> Self
Create a new PhysicalSortExpr
Sourcepub fn new_default(expr: Arc<dyn PhysicalExpr>) -> Self
pub fn new_default(expr: Arc<dyn PhysicalExpr>) -> Self
Create a new PhysicalSortExpr with default SortOptions
Sourcepub fn nulls_first(self) -> Self
pub fn nulls_first(self) -> Self
Set the sort sort options to NULLS FIRST
Sourcepub fn nulls_last(self) -> Self
pub fn nulls_last(self) -> Self
Set the sort sort options to NULLS LAST
Source§impl PhysicalSortExpr
impl PhysicalSortExpr
Sourcepub fn evaluate_to_sort_column(&self, batch: &RecordBatch) -> Result<SortColumn>
pub fn evaluate_to_sort_column(&self, batch: &RecordBatch) -> Result<SortColumn>
evaluate the sort expression into SortColumn that can be passed into arrow sort kernel
Sourcepub fn satisfy(
&self,
requirement: &PhysicalSortRequirement,
schema: &Schema,
) -> bool
pub fn satisfy( &self, requirement: &PhysicalSortRequirement, schema: &Schema, ) -> bool
Checks whether this sort expression satisfies the given requirement
.
If sort options are unspecified in requirement
, only expressions are
compared for inequality.
Trait Implementations§
Source§impl AsRef<dyn PhysicalExpr> for PhysicalSortExpr
impl AsRef<dyn PhysicalExpr> for PhysicalSortExpr
Access the PhysicalSortExpr as a PhysicalExpr
Source§fn as_ref(&self) -> &(dyn PhysicalExpr + 'static)
fn as_ref(&self) -> &(dyn PhysicalExpr + 'static)
Source§impl Clone for PhysicalSortExpr
impl Clone for PhysicalSortExpr
Source§fn clone(&self) -> PhysicalSortExpr
fn clone(&self) -> PhysicalSortExpr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PhysicalSortExpr
impl Debug for PhysicalSortExpr
Source§impl Display for PhysicalSortExpr
impl Display for PhysicalSortExpr
Source§impl From<PhysicalSortExpr> for PhysicalSortRequirement
impl From<PhysicalSortExpr> for PhysicalSortRequirement
Source§fn from(value: PhysicalSortExpr) -> Self
fn from(value: PhysicalSortExpr) -> Self
Source§impl From<PhysicalSortRequirement> for PhysicalSortExpr
impl From<PhysicalSortRequirement> for PhysicalSortExpr
Source§fn from(value: PhysicalSortRequirement) -> Self
fn from(value: PhysicalSortRequirement) -> Self
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<PhysicalSortExpr> for LexOrdering
impl FromIterator<PhysicalSortExpr> for LexOrdering
Source§fn from_iter<T: IntoIterator<Item = PhysicalSortExpr>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = PhysicalSortExpr>>(iter: T) -> Self
Source§impl Hash for PhysicalSortExpr
impl Hash for PhysicalSortExpr
Source§impl PartialEq for PhysicalSortExpr
impl PartialEq for PhysicalSortExpr
impl Eq for PhysicalSortExpr
Auto Trait Implementations§
impl Freeze for PhysicalSortExpr
impl !RefUnwindSafe for PhysicalSortExpr
impl Send for PhysicalSortExpr
impl Sync for PhysicalSortExpr
impl Unpin for PhysicalSortExpr
impl !UnwindSafe for PhysicalSortExpr
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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