Skip to main content

apply_window

Function apply_window 

Source
pub fn apply_window(
    batch: &RecordBatch,
    functions: &[WindowFn],
    partition_by: &[String],
    value_column: &str,
    memory_tracker: Option<&MemoryTracker>,
) -> Result<RecordBatch>
Expand description

Apply window functions to a RecordBatch.

The input batch is expected to be sorted by timestamp. Window functions are computed over the specified value_column and new columns are appended to the result. All original columns are preserved.

When partition_by is non-empty, the batch is logically partitioned by those columns and each window function is computed independently within each partition.

ยงErrors

Returns an error if required columns are missing or have unsupported types.