lead_int

Function lead_int 

Source
pub fn lead_int<T: Copy + Default>(
    window: IntegerAVT<'_, T>,
    n: usize,
) -> IntegerArray<T>
Expand description

Accesses values from future positions in integer arrays with configurable offset.

Implements SQL LEAD() window function semantics, retrieving values from later positions in the array sequence. Essential for predictive analytics, forward-looking comparisons, and temporal analysis requiring access to future data points.

§Parameters

  • window - Integer array view containing sequential data for lead access
  • n - Lead offset specifying how many positions to look forward

§Returns

Returns an IntegerArray<T> containing:

  • Values from n positions later in the sequence
  • Default values for positions where lead source is unavailable
  • Null mask indicating validity of lead values

§Examples

use minarrow::IntegerArray;
use simd_kernels::kernels::window::lead_int;

let arr = IntegerArray::<i32>::from_slice(&[10, 20, 30, 40]);
let result = lead_int((&arr, 0, arr.len()), 2);