pub struct WindowAggState {
pub window_frame_range: Range<usize>,
pub window_frame_ctx: Option<WindowFrameContext>,
pub last_calculated_index: usize,
pub offset_pruned_rows: usize,
pub out_col: ArrayRef,
pub n_row_result_missing: usize,
pub n_rows_received: usize,
pub is_end: bool,
}Expand description
Holds the state of evaluating a window function
Fields§
§window_frame_range: Range<usize>The range that we calculate the window function
window_frame_ctx: Option<WindowFrameContext>§last_calculated_index: usizeThe index of the first row in the partition’s buffered record batch whose result has not been calculated yet; equivalently, the number of buffered rows with calculated results. The next evaluation pass resumes from this index.
offset_pruned_rows: usizeThe offset of the deleted row number
out_col: ArrayRefStores the results calculated by window frame
n_row_result_missing: usizeKeeps track of how many rows should be generated to be in sync with input record_batch
n_rows_received: usizeSnapshot of PartitionBatchState::n_rows_received as of this
partition’s last evaluation pass
is_end: boolSnapshot of PartitionBatchState::is_end as of this partition’s
last evaluation pass
Implementations§
Source§impl WindowAggState
impl WindowAggState
pub fn prune_state(&mut self, n_prune: usize)
pub fn update( &mut self, out_col: &ArrayRef, partition_batch_state: &PartitionBatchState, ) -> Result<()>
Sourcepub fn is_up_to_date_with(
&self,
partition_batch_state: &PartitionBatchState,
) -> bool
pub fn is_up_to_date_with( &self, partition_batch_state: &PartitionBatchState, ) -> bool
Returns true when this state is fully up to date with the partition’s buffered batch, meaning another evaluation pass over the partition could not produce any new results or change any state:
last_calculated_indexhas reached the end of the partition’s buffered batch, so every row of this partition that has arrived so far already has a result.- When a partition ends, a final evaluation pass is needed to bring derived state up to date.
Sourcepub fn is_input_unchanged(
&self,
partition_batch_state: &PartitionBatchState,
) -> bool
pub fn is_input_unchanged( &self, partition_batch_state: &PartitionBatchState, ) -> bool
Returns true when the partition’s input is unchanged since the last evaluation pass: no new rows have arrived and the end flag has not changed.
Standard (non-aggregate) window functions read nothing outside their partition, so we can skip re-evaluating them when their input hasn’t changed. Aggregate window functions cannot use this test to skip evaluation, because they also consult the ORDER BY values of the most recent input row across all partitions.
pub fn new(out_type: &DataType) -> Result<Self>
Trait Implementations§
Source§impl Clone for WindowAggState
impl Clone for WindowAggState
Auto Trait Implementations§
impl !RefUnwindSafe for WindowAggState
impl !UnwindSafe for WindowAggState
impl Forget for WindowAggState
impl Freeze for WindowAggState
impl Move for WindowAggState
impl Send for WindowAggState
impl Sync for WindowAggState
impl Unpin for WindowAggState
impl UnsafeUnpin for WindowAggState
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