Skip to main content

WindowSpec

Struct WindowSpec 

Source
pub struct WindowSpec {
    pub partition: Slice,
    pub order: Slice,
    pub unit: WindowUnit,
    pub start: WindowBound,
    pub end: WindowBound,
    pub exclude: WindowExclude,
}
Expand description

Everything inside the parentheses of an OVER.

A named window is resolved here rather than downstream, because the resolution is a parser question on the reference binary: a reference to a window nobody defined is a Parser Error there, and a view written with OVER w comes back out of the catalog with the definition inlined. So nothing after the transform ever sees a name, and there is no window clause on Select for it to see one in.

Fields§

§partition: Slice

The PARTITION BY list, as a run of ExprRef, empty when there was no clause.

§order: Slice

The ORDER BY list, as a run of OrderItem, empty when there was no clause.

§unit: WindowUnit

Which of the three units the bounds are measured in.

§start: WindowBound

Where the frame starts.

§end: WindowBound

Where the frame ends.

§exclude: WindowExclude

Which peers the frame drops.

Implementations§

Source§

impl WindowSpec

Source

pub const DEFAULT_UNIT: WindowUnit = WindowUnit::Range

The frame a window with no frame clause gets, which the standard fixes and DuckDB follows.

Source

pub const DEFAULT_START: WindowBound = WindowBound::UnboundedPreceding

The start a window with no frame clause gets.

Source

pub const DEFAULT_END: WindowBound = WindowBound::CurrentRow

The end a window with no frame clause gets.

Source

pub const fn empty() -> Self

A window with no clauses at all, which is what OVER () means.

Source

pub fn frame_is_default(&self) -> bool

Whether the frame is the one an unwritten frame clause means.

This is what decides whether the frame is printed, which is not a matter of taste: the printed form is the column name a window target gets when the query wrote no alias, so SELECT sum(x) OVER (ORDER BY x) has to be named without a frame in it to agree with the reference binary.

Trait Implementations§

Source§

impl Clone for WindowSpec

Source§

fn clone(&self) -> WindowSpec

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 Copy for WindowSpec

Source§

impl Debug for WindowSpec

Source§

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

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

impl Eq for WindowSpec

Source§

impl PartialEq for WindowSpec

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WindowSpec

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.