pub struct WindowFrame {
pub units: WindowFrameUnits,
pub start_bound: WindowFrameBound,
pub end_bound: WindowFrameBound,
causal: bool,
}Expand description
The frame specification determines which output rows are read by an aggregate
window function. The ending frame boundary can be omitted if the BETWEEN
and AND keywords that surround the starting frame boundary are also omitted,
in which case the ending frame boundary defaults to CURRENT ROW.
Fields§
§units: WindowFrameUnitsFrame type - either ROWS, RANGE or GROUPS
start_bound: WindowFrameBoundStarting frame boundary
end_bound: WindowFrameBoundEnding frame boundary
causal: boolFlag indicating whether the frame is causal (i.e. computing the result for the current row doesn’t depend on any subsequent rows).
Example causal window frames:
+--------------+
Future | |
| | |
| | |
Current Row |+------------+| ---
| | | |
| | | |
| | | | Window Frame 1
Past | | |
| | |
| | ---
+--------------+
+--------------+
Future | |
| | |
| | |
Current Row |+------------+|
| | |
| | | ---
| | | |
Past | | | Window Frame 2
| | |
| | ---
+--------------+Example non-causal window frame:
+--------------+
Future | |
| | |
| | | ---
Current Row |+------------+| |
| | | | Window Frame 3
| | | |
| | | ---
Past | |
| |
| |
+--------------+Implementations§
Source§impl WindowFrame
impl WindowFrame
Sourcepub fn new(order_by: Option<bool>) -> Self
pub fn new(order_by: Option<bool>) -> Self
Creates a new, default window frame (with the meaning of default
depending on whether the frame contains an ORDER BY clause and this
ordering is strict (i.e. no ties).
Sourcepub fn reverse(&self) -> Self
pub fn reverse(&self) -> Self
Get reversed window frame. For example
3 ROWS PRECEDING AND 2 ROWS FOLLOWING –>
2 ROWS PRECEDING AND 3 ROWS FOLLOWING
Sourcepub fn new_bounds(
units: WindowFrameUnits,
start_bound: WindowFrameBound,
end_bound: WindowFrameBound,
) -> Self
pub fn new_bounds( units: WindowFrameUnits, start_bound: WindowFrameBound, end_bound: WindowFrameBound, ) -> Self
Initializes window frame from units (type), start bound and end bound.
Sourcepub fn regularize_order_bys(&self, order_by: &mut Vec<Sort>) -> Result<()>
pub fn regularize_order_bys(&self, order_by: &mut Vec<Sort>) -> Result<()>
Regularizes the ORDER BY clause of the window frame.
Sourcepub fn can_accept_multi_orderby(&self) -> bool
pub fn can_accept_multi_orderby(&self) -> bool
Returns whether the window frame can accept multiple ORDER BY expressions.
Sourcefn free_range(&self) -> bool
fn free_range(&self) -> bool
Returns whether the window frame is “free range”; i.e. its start/end bounds are UNBOUNDED or CURRENT ROW.
Sourcepub fn is_ever_expanding(&self) -> bool
pub fn is_ever_expanding(&self) -> bool
Is the window frame ever-expanding (it always grows in the superset sense). Useful when understanding if set-monotonicity properties of functions can be exploited.
Trait Implementations§
Source§impl Clone for WindowFrame
impl Clone for WindowFrame
Source§fn clone(&self) -> WindowFrame
fn clone(&self) -> WindowFrame
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WindowFrame
impl Debug for WindowFrame
Source§impl Display for WindowFrame
impl Display for WindowFrame
Source§impl Hash for WindowFrame
impl Hash for WindowFrame
Source§impl PartialEq for WindowFrame
impl PartialEq for WindowFrame
Source§impl PartialOrd for WindowFrame
impl PartialOrd for WindowFrame
Source§impl TryFrom<WindowFrame> for WindowFrame
impl TryFrom<WindowFrame> for WindowFrame
impl Eq for WindowFrame
impl StructuralPartialEq for WindowFrame
Auto Trait Implementations§
impl Freeze for WindowFrame
impl !RefUnwindSafe for WindowFrame
impl Send for WindowFrame
impl Sync for WindowFrame
impl Unpin for WindowFrame
impl !UnwindSafe for WindowFrame
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.