pub struct WindowContext { /* private fields */ }
Expand description
Context for evaluating window functions
Implementations§
Source§impl WindowContext
impl WindowContext
Sourcepub fn new(
view: Arc<DataView>,
partition_by: Vec<String>,
order_by: Vec<OrderByColumn>,
) -> Result<Self>
pub fn new( view: Arc<DataView>, partition_by: Vec<String>, order_by: Vec<OrderByColumn>, ) -> Result<Self>
Create a new window context with partitioning and ordering
Sourcepub fn new_with_spec(view: Arc<DataView>, spec: WindowSpec) -> Result<Self>
pub fn new_with_spec(view: Arc<DataView>, spec: WindowSpec) -> Result<Self>
Create a new window context with a full window specification
Sourcepub fn get_offset_value(
&self,
current_row: usize,
offset: i32,
column: &str,
) -> Option<DataValue>
pub fn get_offset_value( &self, current_row: usize, offset: i32, column: &str, ) -> Option<DataValue>
Get value at offset from current row (for LAG/LEAD)
Sourcepub fn get_row_number(&self, row_index: usize) -> usize
pub fn get_row_number(&self, row_index: usize) -> usize
Get row number within partition (1-based)
Sourcepub fn get_frame_first_value(
&self,
row_index: usize,
column: &str,
) -> Option<DataValue>
pub fn get_frame_first_value( &self, row_index: usize, column: &str, ) -> Option<DataValue>
Get first value in frame
Sourcepub fn get_frame_last_value(
&self,
row_index: usize,
column: &str,
) -> Option<DataValue>
pub fn get_frame_last_value( &self, row_index: usize, column: &str, ) -> Option<DataValue>
Get last value in frame
Sourcepub fn get_first_value(
&self,
row_index: usize,
column: &str,
) -> Option<DataValue>
pub fn get_first_value( &self, row_index: usize, column: &str, ) -> Option<DataValue>
Get first value in partition
Sourcepub fn get_last_value(
&self,
row_index: usize,
column: &str,
) -> Option<DataValue>
pub fn get_last_value( &self, row_index: usize, column: &str, ) -> Option<DataValue>
Get last value in partition
Sourcepub fn partition_count(&self) -> usize
pub fn partition_count(&self) -> usize
Get the number of partitions
Sourcepub fn has_partitions(&self) -> bool
pub fn has_partitions(&self) -> bool
Check if context has partitions (vs single window)
Sourcepub fn get_frame_rows(&self, row_index: usize) -> Vec<usize>
pub fn get_frame_rows(&self, row_index: usize) -> Vec<usize>
Get row indices within the window frame for a given row
Sourcepub fn get_frame_sum(&self, row_index: usize, column: &str) -> Option<DataValue>
pub fn get_frame_sum(&self, row_index: usize, column: &str) -> Option<DataValue>
Calculate sum of a column within the window frame for the given row
Sourcepub fn get_frame_count(
&self,
row_index: usize,
column: Option<&str>,
) -> Option<DataValue>
pub fn get_frame_count( &self, row_index: usize, column: Option<&str>, ) -> Option<DataValue>
Calculate count within the window frame
Sourcepub fn get_frame_avg(&self, row_index: usize, column: &str) -> Option<DataValue>
pub fn get_frame_avg(&self, row_index: usize, column: &str) -> Option<DataValue>
Calculate average of a column within the window frame
Sourcepub fn get_frame_stddev(
&self,
row_index: usize,
column: &str,
) -> Option<DataValue>
pub fn get_frame_stddev( &self, row_index: usize, column: &str, ) -> Option<DataValue>
Calculate standard deviation within the window frame (sample stddev)
Sourcepub fn get_frame_variance(
&self,
row_index: usize,
column: &str,
) -> Option<DataValue>
pub fn get_frame_variance( &self, row_index: usize, column: &str, ) -> Option<DataValue>
Calculate variance within the window frame (sample variance with n-1)
Auto Trait Implementations§
impl Freeze for WindowContext
impl !RefUnwindSafe for WindowContext
impl Send for WindowContext
impl Sync for WindowContext
impl Unpin for WindowContext
impl !UnwindSafe for WindowContext
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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