Skip to main content

evaluate_window

Function evaluate_window 

Source
pub fn evaluate_window(
    func: &WindowFunction,
    spec: &WindowSpec,
    num_rows: usize,
    target_column: usize,
    value_at: impl Fn(usize, usize) -> Value,
) -> Result<Vec<Value>>
Expand description

Evaluate a window function over num_rows rows.

value_at(row_index, column_index) must return the Value stored at that position; this is the closure-based analogue of indexing a concrete row. The target_column is the column referenced by value-returning functions (LAG, LEAD, FIRST_VALUE, LAST_VALUE, NTH_VALUE); it is ignored by the ranking functions but still validated so callers fail fast on bad input.

Returns exactly one Value per input row, in input order.