pub enum WindowFunction {
RowNumber,
Rank,
DenseRank,
Lag {
offset: usize,
default: Option<Value>,
},
Lead {
offset: usize,
default: Option<Value>,
},
FirstValue,
LastValue,
NthValue {
n: usize,
},
}Expand description
A window function to evaluate over partitioned, ordered rows.
Variants§
RowNumber
ROW_NUMBER() — 1-based sequential ordinal within the partition.
Rank
RANK() — competition ranking with gaps after ties.
DenseRank
DENSE_RANK() — ranking without gaps after ties.
Lag
LAG(expr[, offset[, default]]).
Fields
Lead
LEAD(expr[, offset[, default]]).
Fields
FirstValue
FIRST_VALUE(expr) — first value of expr in the sorted partition.
LastValue
LAST_VALUE(expr) — last value of expr in the sorted partition.
NthValue
NTH_VALUE(expr, n) — the n-th (1-based) value in the sorted partition.
Implementations§
Source§impl WindowFunction
impl WindowFunction
Sourcepub fn lag_offset(offset: usize) -> Self
pub fn lag_offset(offset: usize) -> Self
LAG(expr, offset) with a NULL fallback.
Sourcepub fn lag_offset_default(offset: usize, default: Value) -> Self
pub fn lag_offset_default(offset: usize, default: Value) -> Self
LAG(expr, offset, default).
Sourcepub fn lead_offset(offset: usize) -> Self
pub fn lead_offset(offset: usize) -> Self
LEAD(expr, offset) with a NULL fallback.
Sourcepub fn lead_offset_default(offset: usize, default: Value) -> Self
pub fn lead_offset_default(offset: usize, default: Value) -> Self
LEAD(expr, offset, default).
Sourcepub fn reads_target(&self) -> bool
pub fn reads_target(&self) -> bool
Whether the function reads a target column (LAG/LEAD/*_VALUE).
Ranking functions (ROW_NUMBER, RANK, DENSE_RANK) ignore the target
column entirely.
Trait Implementations§
Source§impl Clone for WindowFunction
impl Clone for WindowFunction
Source§fn clone(&self) -> WindowFunction
fn clone(&self) -> WindowFunction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WindowFunction
impl Debug for WindowFunction
Source§impl PartialEq for WindowFunction
impl PartialEq for WindowFunction
Source§fn eq(&self, other: &WindowFunction) -> bool
fn eq(&self, other: &WindowFunction) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for WindowFunction
Auto Trait Implementations§
impl Freeze for WindowFunction
impl RefUnwindSafe for WindowFunction
impl Send for WindowFunction
impl Sync for WindowFunction
impl Unpin for WindowFunction
impl UnsafeUnpin for WindowFunction
impl UnwindSafe for WindowFunction
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