evaluate_count_window

Function evaluate_count_window 

Source
pub fn evaluate_count_window<F, I>(
    partition: &Partition,
    frame_indices: I,
    arg_expr: Option<&Expression>,
    filter: Option<&Expression>,
    eval_fn: F,
) -> SqlValue
where F: Fn(&Expression, &Row) -> Result<SqlValue, String>, I: IntoIterator<Item = usize>,
Expand description

Evaluate COUNT aggregate window function over a frame

Counts rows in the frame. Two variants:

  • COUNT(*): counts all rows in frame
  • COUNT(expr): counts rows where expr is not NULL

Supports FILTER clause for conditional aggregation. Supports EXCLUDE clause via frame_indices iterator.

Example: COUNT(*) FILTER (WHERE x > 0) OVER (ROWS BETWEEN 2 PRECEDING AND CURRENT ROW)