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: SliceThe PARTITION BY list, as a run of ExprRef, empty when there was no clause.
order: SliceThe ORDER BY list, as a run of OrderItem, empty when there was no clause.
unit: WindowUnitWhich of the three units the bounds are measured in.
start: WindowBoundWhere the frame starts.
end: WindowBoundWhere the frame ends.
exclude: WindowExcludeWhich peers the frame drops.
Implementations§
Source§impl WindowSpec
impl WindowSpec
Sourcepub const DEFAULT_UNIT: WindowUnit = WindowUnit::Range
pub const DEFAULT_UNIT: WindowUnit = WindowUnit::Range
The frame a window with no frame clause gets, which the standard fixes and DuckDB follows.
Sourcepub const DEFAULT_START: WindowBound = WindowBound::UnboundedPreceding
pub const DEFAULT_START: WindowBound = WindowBound::UnboundedPreceding
The start a window with no frame clause gets.
Sourcepub const DEFAULT_END: WindowBound = WindowBound::CurrentRow
pub const DEFAULT_END: WindowBound = WindowBound::CurrentRow
The end a window with no frame clause gets.
Sourcepub fn frame_is_default(&self) -> bool
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
impl Clone for WindowSpec
Source§fn clone(&self) -> WindowSpec
fn clone(&self) -> WindowSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more