pub fn lag_int<T: Copy + Default>(
window: IntegerAVT<'_, T>,
n: usize,
) -> IntegerArray<T>Expand description
Accesses values from previous positions in integer arrays with configurable offset.
Implements SQL LAG() window function semantics, retrieving values from earlier positions in the array sequence. Essential for time series analysis, trend detection, and comparative analytics requiring access to historical data points.
§Parameters
window- Integer array view containing sequential data for lag accessn- Lag offset specifying how many positions to look backward
§Returns
Returns an IntegerArray<T> containing:
- Values from n positions earlier in the sequence
- Default values for positions where lag source is unavailable
- Null mask indicating validity of lagged values
§Examples
ⓘ
use minarrow::IntegerArray;
use simd_kernels::kernels::window::lag_int;
let arr = IntegerArray::<i32>::from_slice(&[10, 20, 30, 40]);
let result = lag_int((&arr, 0, arr.len()), 1);