Skip to main content

lead_int_to

Function lead_int_to 

Source
pub fn lead_int_to<T: Copy + Default>(
    data: &[T],
    mask: Option<&Bitmask>,
    n: usize,
    out: &mut [T],
    out_mask: &mut Bitmask,
)
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);

Zero-allocation variant that writes directly to caller-provided output buffers.